xref: /aoo41x/main/vcl/source/app/settings.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_vcl.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "tools/debug.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "i18npool/mslangid.hxx"
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include "vcl/svapp.hxx"
36*cdf0e10cSrcweir #include "vcl/event.hxx"
37*cdf0e10cSrcweir #include "vcl/settings.hxx"
38*cdf0e10cSrcweir #include "vcl/i18nhelp.hxx"
39*cdf0e10cSrcweir #include "vcl/configsettings.hxx"
40*cdf0e10cSrcweir #include "vcl/gradient.hxx"
41*cdf0e10cSrcweir #include "vcl/unohelp.hxx"
42*cdf0e10cSrcweir #include "vcl/bitmapex.hxx"
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir #include "unotools/fontcfg.hxx"
45*cdf0e10cSrcweir #include "unotools/localedatawrapper.hxx"
46*cdf0e10cSrcweir #include "unotools/collatorwrapper.hxx"
47*cdf0e10cSrcweir #include "unotools/configmgr.hxx"
48*cdf0e10cSrcweir #include "unotools/confignode.hxx"
49*cdf0e10cSrcweir #include "unotools/syslocaleoptions.hxx"
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir #ifdef WNT
52*cdf0e10cSrcweir #include "tools/prewin.h"
53*cdf0e10cSrcweir #include <windows.h>
54*cdf0e10cSrcweir #include "tools/postwin.h"
55*cdf0e10cSrcweir #endif
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir #include "svdata.hxx"
58*cdf0e10cSrcweir #include "impimagetree.hxx"
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir using namespace rtl;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir // =======================================================================
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir DBG_NAME( AllSettings )
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir // =======================================================================
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir #define STDSYS_STYLE            (STYLE_OPTION_SCROLLARROW |     \
69*cdf0e10cSrcweir                                  STYLE_OPTION_SPINARROW |       \
70*cdf0e10cSrcweir                                  STYLE_OPTION_SPINUPDOWN |      \
71*cdf0e10cSrcweir                                  STYLE_OPTION_NOMNEMONICS)
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir // =======================================================================
74*cdf0e10cSrcweir ImplMachineData::ImplMachineData()
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir     mnRefCount                  = 1;
77*cdf0e10cSrcweir     mnOptions                   = 0;
78*cdf0e10cSrcweir     mnScreenOptions             = 0;
79*cdf0e10cSrcweir     mnPrintOptions              = 0;
80*cdf0e10cSrcweir     mnScreenRasterFontDeviation = 0;
81*cdf0e10cSrcweir }
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir // -----------------------------------------------------------------------
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir ImplMachineData::ImplMachineData( const ImplMachineData& rData )
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir     mnRefCount                  = 1;
88*cdf0e10cSrcweir     mnOptions                   = rData.mnOptions;
89*cdf0e10cSrcweir     mnScreenOptions             = rData.mnScreenOptions;
90*cdf0e10cSrcweir     mnPrintOptions              = rData.mnPrintOptions;
91*cdf0e10cSrcweir     mnScreenRasterFontDeviation = rData.mnScreenRasterFontDeviation;
92*cdf0e10cSrcweir }
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir // -----------------------------------------------------------------------
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir MachineSettings::MachineSettings()
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir     mpData = new ImplMachineData();
99*cdf0e10cSrcweir }
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir // -----------------------------------------------------------------------
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir MachineSettings::MachineSettings( const MachineSettings& rSet )
104*cdf0e10cSrcweir {
105*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "MachineSettings: RefCount overflow" );
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     // shared Instance Daten uebernehmen und Referenzcounter erhoehen
108*cdf0e10cSrcweir     mpData = rSet.mpData;
109*cdf0e10cSrcweir     mpData->mnRefCount++;
110*cdf0e10cSrcweir }
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir // -----------------------------------------------------------------------
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir MachineSettings::~MachineSettings()
115*cdf0e10cSrcweir {
116*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
117*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
118*cdf0e10cSrcweir         delete mpData;
119*cdf0e10cSrcweir     else
120*cdf0e10cSrcweir         mpData->mnRefCount--;
121*cdf0e10cSrcweir }
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir // -----------------------------------------------------------------------
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir const MachineSettings& MachineSettings::operator =( const MachineSettings& rSet )
126*cdf0e10cSrcweir {
127*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "MachineSettings: RefCount overflow" );
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir     // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
130*cdf0e10cSrcweir     rSet.mpData->mnRefCount++;
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
133*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
134*cdf0e10cSrcweir         delete mpData;
135*cdf0e10cSrcweir     else
136*cdf0e10cSrcweir         mpData->mnRefCount--;
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir     mpData = rSet.mpData;
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir     return *this;
141*cdf0e10cSrcweir }
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir // -----------------------------------------------------------------------
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir void MachineSettings::CopyData()
146*cdf0e10cSrcweir {
147*cdf0e10cSrcweir     // Falls noch andere Referenzen bestehen, dann kopieren
148*cdf0e10cSrcweir     if ( mpData->mnRefCount != 1 )
149*cdf0e10cSrcweir     {
150*cdf0e10cSrcweir         mpData->mnRefCount--;
151*cdf0e10cSrcweir         mpData = new ImplMachineData( *mpData );
152*cdf0e10cSrcweir     }
153*cdf0e10cSrcweir }
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir // -----------------------------------------------------------------------
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir sal_Bool MachineSettings::operator ==( const MachineSettings& rSet ) const
158*cdf0e10cSrcweir {
159*cdf0e10cSrcweir     if ( mpData == rSet.mpData )
160*cdf0e10cSrcweir         return sal_True;
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir     if ( (mpData->mnOptions                     == rSet.mpData->mnOptions)                  &&
163*cdf0e10cSrcweir          (mpData->mnScreenOptions               == rSet.mpData->mnScreenOptions)            &&
164*cdf0e10cSrcweir          (mpData->mnPrintOptions                == rSet.mpData->mnPrintOptions)             &&
165*cdf0e10cSrcweir          (mpData->mnScreenRasterFontDeviation   == rSet.mpData->mnScreenRasterFontDeviation) )
166*cdf0e10cSrcweir         return sal_True;
167*cdf0e10cSrcweir     else
168*cdf0e10cSrcweir         return sal_False;
169*cdf0e10cSrcweir }
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir // =======================================================================
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir ImplMouseData::ImplMouseData()
174*cdf0e10cSrcweir {
175*cdf0e10cSrcweir     mnRefCount                  = 1;
176*cdf0e10cSrcweir     mnOptions                   = 0;
177*cdf0e10cSrcweir     mnDoubleClkTime             = 500;
178*cdf0e10cSrcweir     mnDoubleClkWidth            = 2;
179*cdf0e10cSrcweir     mnDoubleClkHeight           = 2;
180*cdf0e10cSrcweir     mnStartDragWidth            = 2;
181*cdf0e10cSrcweir     mnStartDragHeight           = 2;
182*cdf0e10cSrcweir     mnStartDragCode             = MOUSE_LEFT;
183*cdf0e10cSrcweir     mnDragMoveCode              = 0;
184*cdf0e10cSrcweir     mnDragCopyCode              = KEY_MOD1;
185*cdf0e10cSrcweir     mnDragLinkCode              = KEY_SHIFT | KEY_MOD1;
186*cdf0e10cSrcweir     mnContextMenuCode           = MOUSE_RIGHT;
187*cdf0e10cSrcweir     mnContextMenuClicks         = 1;
188*cdf0e10cSrcweir     mbContextMenuDown           = sal_True;
189*cdf0e10cSrcweir     mnMiddleButtonAction        = MOUSE_MIDDLE_AUTOSCROLL;
190*cdf0e10cSrcweir     mnScrollRepeat              = 100;
191*cdf0e10cSrcweir     mnButtonStartRepeat         = 370;
192*cdf0e10cSrcweir     mnButtonRepeat              = 90;
193*cdf0e10cSrcweir     mnActionDelay               = 250;
194*cdf0e10cSrcweir     mnMenuDelay                 = 150;
195*cdf0e10cSrcweir     mnFollow                    = MOUSE_FOLLOW_MENU | MOUSE_FOLLOW_DDLIST;
196*cdf0e10cSrcweir     mnWheelBehavior             = MOUSE_WHEEL_ALWAYS;
197*cdf0e10cSrcweir }
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir // -----------------------------------------------------------------------
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir ImplMouseData::ImplMouseData( const ImplMouseData& rData )
202*cdf0e10cSrcweir {
203*cdf0e10cSrcweir     mnRefCount                  = 1;
204*cdf0e10cSrcweir     mnOptions                   = rData.mnOptions;
205*cdf0e10cSrcweir     mnDoubleClkTime             = rData.mnDoubleClkTime;
206*cdf0e10cSrcweir     mnDoubleClkWidth            = rData.mnDoubleClkWidth;
207*cdf0e10cSrcweir     mnDoubleClkHeight           = rData.mnDoubleClkHeight;
208*cdf0e10cSrcweir     mnStartDragWidth            = rData.mnStartDragWidth;
209*cdf0e10cSrcweir     mnStartDragHeight           = rData.mnStartDragHeight;
210*cdf0e10cSrcweir     mnStartDragCode             = rData.mnStartDragCode;
211*cdf0e10cSrcweir     mnDragMoveCode              = rData.mnDragMoveCode;
212*cdf0e10cSrcweir     mnDragCopyCode              = rData.mnDragCopyCode;
213*cdf0e10cSrcweir     mnDragLinkCode              = rData.mnDragLinkCode;
214*cdf0e10cSrcweir     mnContextMenuCode           = rData.mnContextMenuCode;
215*cdf0e10cSrcweir     mnContextMenuClicks         = rData.mnContextMenuClicks;
216*cdf0e10cSrcweir     mbContextMenuDown           = rData.mbContextMenuDown;
217*cdf0e10cSrcweir     mnMiddleButtonAction        = rData.mnMiddleButtonAction;
218*cdf0e10cSrcweir     mnScrollRepeat              = rData.mnScrollRepeat;
219*cdf0e10cSrcweir     mnButtonStartRepeat         = rData.mnButtonStartRepeat;
220*cdf0e10cSrcweir     mnButtonRepeat              = rData.mnButtonRepeat;
221*cdf0e10cSrcweir     mnActionDelay               = rData.mnActionDelay;
222*cdf0e10cSrcweir     mnMenuDelay                 = rData.mnMenuDelay;
223*cdf0e10cSrcweir     mnFollow                    = rData.mnFollow;
224*cdf0e10cSrcweir     mnWheelBehavior             = rData.mnWheelBehavior;
225*cdf0e10cSrcweir }
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir // -----------------------------------------------------------------------
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir MouseSettings::MouseSettings()
230*cdf0e10cSrcweir {
231*cdf0e10cSrcweir     mpData = new ImplMouseData();
232*cdf0e10cSrcweir }
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir // -----------------------------------------------------------------------
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir MouseSettings::MouseSettings( const MouseSettings& rSet )
237*cdf0e10cSrcweir {
238*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "MouseSettings: RefCount overflow" );
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir     // shared Instance Daten uebernehmen und Referenzcounter erhoehen
241*cdf0e10cSrcweir     mpData = rSet.mpData;
242*cdf0e10cSrcweir     mpData->mnRefCount++;
243*cdf0e10cSrcweir }
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir // -----------------------------------------------------------------------
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir MouseSettings::~MouseSettings()
248*cdf0e10cSrcweir {
249*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
250*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
251*cdf0e10cSrcweir         delete mpData;
252*cdf0e10cSrcweir     else
253*cdf0e10cSrcweir         mpData->mnRefCount--;
254*cdf0e10cSrcweir }
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir // -----------------------------------------------------------------------
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir const MouseSettings& MouseSettings::operator =( const MouseSettings& rSet )
259*cdf0e10cSrcweir {
260*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "MouseSettings: RefCount overflow" );
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir     // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
263*cdf0e10cSrcweir     rSet.mpData->mnRefCount++;
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
266*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
267*cdf0e10cSrcweir         delete mpData;
268*cdf0e10cSrcweir     else
269*cdf0e10cSrcweir         mpData->mnRefCount--;
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir     mpData = rSet.mpData;
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir     return *this;
274*cdf0e10cSrcweir }
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir // -----------------------------------------------------------------------
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir void MouseSettings::CopyData()
279*cdf0e10cSrcweir {
280*cdf0e10cSrcweir     // Falls noch andere Referenzen bestehen, dann kopieren
281*cdf0e10cSrcweir     if ( mpData->mnRefCount != 1 )
282*cdf0e10cSrcweir     {
283*cdf0e10cSrcweir         mpData->mnRefCount--;
284*cdf0e10cSrcweir         mpData = new ImplMouseData( *mpData );
285*cdf0e10cSrcweir     }
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir // -----------------------------------------------------------------------
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir sal_Bool MouseSettings::operator ==( const MouseSettings& rSet ) const
291*cdf0e10cSrcweir {
292*cdf0e10cSrcweir     if ( mpData == rSet.mpData )
293*cdf0e10cSrcweir         return sal_True;
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir     if ( (mpData->mnOptions             == rSet.mpData->mnOptions)              &&
296*cdf0e10cSrcweir          (mpData->mnDoubleClkTime       == rSet.mpData->mnDoubleClkTime)        &&
297*cdf0e10cSrcweir          (mpData->mnDoubleClkWidth      == rSet.mpData->mnDoubleClkWidth)       &&
298*cdf0e10cSrcweir          (mpData->mnDoubleClkHeight     == rSet.mpData->mnDoubleClkHeight)      &&
299*cdf0e10cSrcweir          (mpData->mnStartDragWidth      == rSet.mpData->mnStartDragWidth)       &&
300*cdf0e10cSrcweir          (mpData->mnStartDragHeight     == rSet.mpData->mnStartDragHeight)      &&
301*cdf0e10cSrcweir          (mpData->mnStartDragCode       == rSet.mpData->mnStartDragCode)        &&
302*cdf0e10cSrcweir          (mpData->mnDragMoveCode        == rSet.mpData->mnDragMoveCode)         &&
303*cdf0e10cSrcweir          (mpData->mnDragCopyCode        == rSet.mpData->mnDragCopyCode)         &&
304*cdf0e10cSrcweir          (mpData->mnDragLinkCode        == rSet.mpData->mnDragLinkCode)         &&
305*cdf0e10cSrcweir          (mpData->mnContextMenuCode     == rSet.mpData->mnContextMenuCode)      &&
306*cdf0e10cSrcweir          (mpData->mnContextMenuClicks   == rSet.mpData->mnContextMenuClicks)    &&
307*cdf0e10cSrcweir          (mpData->mbContextMenuDown     == rSet.mpData->mbContextMenuDown)      &&
308*cdf0e10cSrcweir          (mpData->mnMiddleButtonAction  == rSet.mpData->mnMiddleButtonAction)   &&
309*cdf0e10cSrcweir          (mpData->mnScrollRepeat        == rSet.mpData->mnScrollRepeat)         &&
310*cdf0e10cSrcweir          (mpData->mnButtonStartRepeat   == rSet.mpData->mnButtonStartRepeat)    &&
311*cdf0e10cSrcweir          (mpData->mnButtonRepeat        == rSet.mpData->mnButtonRepeat)         &&
312*cdf0e10cSrcweir          (mpData->mnActionDelay         == rSet.mpData->mnActionDelay)          &&
313*cdf0e10cSrcweir          (mpData->mnMenuDelay           == rSet.mpData->mnMenuDelay)            &&
314*cdf0e10cSrcweir          (mpData->mnFollow              == rSet.mpData->mnFollow)               &&
315*cdf0e10cSrcweir          (mpData->mnWheelBehavior       == rSet.mpData->mnWheelBehavior ) )
316*cdf0e10cSrcweir         return sal_True;
317*cdf0e10cSrcweir     else
318*cdf0e10cSrcweir         return sal_False;
319*cdf0e10cSrcweir }
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir // =======================================================================
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir ImplKeyboardData::ImplKeyboardData()
324*cdf0e10cSrcweir {
325*cdf0e10cSrcweir     mnRefCount                  = 1;
326*cdf0e10cSrcweir     mnOptions                   = 0;
327*cdf0e10cSrcweir }
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir // -----------------------------------------------------------------------
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir ImplKeyboardData::ImplKeyboardData( const ImplKeyboardData& rData )
332*cdf0e10cSrcweir {
333*cdf0e10cSrcweir     mnRefCount                  = 1;
334*cdf0e10cSrcweir     mnOptions                   = rData.mnOptions;
335*cdf0e10cSrcweir }
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir // -----------------------------------------------------------------------
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir KeyboardSettings::KeyboardSettings()
340*cdf0e10cSrcweir {
341*cdf0e10cSrcweir     mpData = new ImplKeyboardData();
342*cdf0e10cSrcweir }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir // -----------------------------------------------------------------------
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir KeyboardSettings::KeyboardSettings( const KeyboardSettings& rSet )
347*cdf0e10cSrcweir {
348*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "KeyboardSettings: RefCount overflow" );
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir     // shared Instance Daten uebernehmen und Referenzcounter erhoehen
351*cdf0e10cSrcweir     mpData = rSet.mpData;
352*cdf0e10cSrcweir     mpData->mnRefCount++;
353*cdf0e10cSrcweir }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir // -----------------------------------------------------------------------
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir KeyboardSettings::~KeyboardSettings()
358*cdf0e10cSrcweir {
359*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
360*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
361*cdf0e10cSrcweir         delete mpData;
362*cdf0e10cSrcweir     else
363*cdf0e10cSrcweir         mpData->mnRefCount--;
364*cdf0e10cSrcweir }
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir // -----------------------------------------------------------------------
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir const KeyboardSettings& KeyboardSettings::operator =( const KeyboardSettings& rSet )
369*cdf0e10cSrcweir {
370*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "KeyboardSettings: RefCount overflow" );
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir     // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
373*cdf0e10cSrcweir     rSet.mpData->mnRefCount++;
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
376*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
377*cdf0e10cSrcweir         delete mpData;
378*cdf0e10cSrcweir     else
379*cdf0e10cSrcweir         mpData->mnRefCount--;
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir     mpData = rSet.mpData;
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir     return *this;
384*cdf0e10cSrcweir }
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir // -----------------------------------------------------------------------
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir void KeyboardSettings::CopyData()
389*cdf0e10cSrcweir {
390*cdf0e10cSrcweir     // Falls noch andere Referenzen bestehen, dann kopieren
391*cdf0e10cSrcweir     if ( mpData->mnRefCount != 1 )
392*cdf0e10cSrcweir     {
393*cdf0e10cSrcweir         mpData->mnRefCount--;
394*cdf0e10cSrcweir         mpData = new ImplKeyboardData( *mpData );
395*cdf0e10cSrcweir     }
396*cdf0e10cSrcweir }
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir // -----------------------------------------------------------------------
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir sal_Bool KeyboardSettings::operator ==( const KeyboardSettings& rSet ) const
401*cdf0e10cSrcweir {
402*cdf0e10cSrcweir     if ( mpData == rSet.mpData )
403*cdf0e10cSrcweir         return sal_True;
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir     if ( (mpData->mnOptions             == rSet.mpData->mnOptions) )
406*cdf0e10cSrcweir         return sal_True;
407*cdf0e10cSrcweir     else
408*cdf0e10cSrcweir         return sal_False;
409*cdf0e10cSrcweir }
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir // =======================================================================
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir ImplStyleData::ImplStyleData()
414*cdf0e10cSrcweir {
415*cdf0e10cSrcweir     mnRefCount                  = 1;
416*cdf0e10cSrcweir     mnScrollBarSize             = 16;
417*cdf0e10cSrcweir     mnMinThumbSize              = 16;
418*cdf0e10cSrcweir     mnSplitSize                 = 3;
419*cdf0e10cSrcweir     mnSpinSize                  = 16;
420*cdf0e10cSrcweir     mnIconHorzSpace             = 50;
421*cdf0e10cSrcweir     mnIconVertSpace             = 40;
422*cdf0e10cSrcweir     mnAntialiasedMin            = 0;
423*cdf0e10cSrcweir     mnCursorSize                = 2;
424*cdf0e10cSrcweir     mnCursorBlinkTime           = STYLE_CURSOR_NOBLINKTIME;
425*cdf0e10cSrcweir     mnScreenZoom                = 100;
426*cdf0e10cSrcweir     mnScreenFontZoom            = 100;
427*cdf0e10cSrcweir     mnLogoDisplayTime           = LOGO_DISPLAYTIME_STARTTIME;
428*cdf0e10cSrcweir     mnDragFullOptions           = DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE |
429*cdf0e10cSrcweir                                   DRAGFULL_OPTION_OBJECTMOVE | DRAGFULL_OPTION_OBJECTSIZE |
430*cdf0e10cSrcweir                                   DRAGFULL_OPTION_DOCKING    | DRAGFULL_OPTION_SPLIT      |
431*cdf0e10cSrcweir                                   DRAGFULL_OPTION_SCROLL;
432*cdf0e10cSrcweir     mnAnimationOptions          = 0;
433*cdf0e10cSrcweir     mnSelectionOptions          = 0;
434*cdf0e10cSrcweir     mnDisplayOptions            = 0;
435*cdf0e10cSrcweir     mnOptions                   = 0;
436*cdf0e10cSrcweir     mnAutoMnemonic				= 1;
437*cdf0e10cSrcweir     mnToolbarIconSize			= STYLE_TOOLBAR_ICONSIZE_UNKNOWN;
438*cdf0e10cSrcweir     mnSymbolsStyle				= STYLE_SYMBOLS_AUTO;
439*cdf0e10cSrcweir     mnPreferredSymbolsStyle			= STYLE_SYMBOLS_AUTO;
440*cdf0e10cSrcweir     mpFontOptions              = NULL;
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir     SetStandardStyles();
443*cdf0e10cSrcweir }
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir // -----------------------------------------------------------------------
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
448*cdf0e10cSrcweir     maActiveBorderColor( rData.maActiveBorderColor ),
449*cdf0e10cSrcweir     maActiveColor( rData.maActiveColor ),
450*cdf0e10cSrcweir     maActiveColor2( rData.maActiveColor2 ),
451*cdf0e10cSrcweir     maActiveTextColor( rData.maActiveTextColor ),
452*cdf0e10cSrcweir     maButtonTextColor( rData.maButtonTextColor ),
453*cdf0e10cSrcweir     maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
454*cdf0e10cSrcweir     maCheckedColor( rData.maCheckedColor ),
455*cdf0e10cSrcweir     maDarkShadowColor( rData.maDarkShadowColor ),
456*cdf0e10cSrcweir     maDeactiveBorderColor( rData.maDeactiveBorderColor ),
457*cdf0e10cSrcweir     maDeactiveColor( rData.maDeactiveColor ),
458*cdf0e10cSrcweir     maDeactiveColor2( rData.maDeactiveColor2 ),
459*cdf0e10cSrcweir     maDeactiveTextColor( rData.maDeactiveTextColor ),
460*cdf0e10cSrcweir     maDialogColor( rData.maDialogColor ),
461*cdf0e10cSrcweir     maDialogTextColor( rData.maDialogTextColor ),
462*cdf0e10cSrcweir     maDisableColor( rData.maDisableColor ),
463*cdf0e10cSrcweir     maFaceColor( rData.maFaceColor ),
464*cdf0e10cSrcweir     maFieldColor( rData.maFieldColor ),
465*cdf0e10cSrcweir     maFieldTextColor( rData.maFieldTextColor ),
466*cdf0e10cSrcweir     maFieldRolloverTextColor( rData.maFieldRolloverTextColor ),
467*cdf0e10cSrcweir 	maFontColor( rData.maFontColor ),
468*cdf0e10cSrcweir     maGroupTextColor( rData.maGroupTextColor ),
469*cdf0e10cSrcweir     maHelpColor( rData.maHelpColor ),
470*cdf0e10cSrcweir     maHelpTextColor( rData.maHelpTextColor ),
471*cdf0e10cSrcweir     maHighlightColor( rData.maHighlightColor ),
472*cdf0e10cSrcweir     maHighlightLinkColor( rData.maHighlightLinkColor ),
473*cdf0e10cSrcweir     maHighlightTextColor( rData.maHighlightTextColor ),
474*cdf0e10cSrcweir     maInfoTextColor( rData.maInfoTextColor ),
475*cdf0e10cSrcweir     maLabelTextColor( rData.maLabelTextColor ),
476*cdf0e10cSrcweir     maLightBorderColor( rData.maLightBorderColor ),
477*cdf0e10cSrcweir     maLightColor( rData.maLightColor ),
478*cdf0e10cSrcweir     maLinkColor( rData.maLinkColor ),
479*cdf0e10cSrcweir     maMenuBarColor( rData.maMenuBarColor ),
480*cdf0e10cSrcweir     maMenuBorderColor( rData.maMenuBorderColor ),
481*cdf0e10cSrcweir     maMenuColor( rData.maMenuColor ),
482*cdf0e10cSrcweir     maMenuHighlightColor( rData.maMenuHighlightColor ),
483*cdf0e10cSrcweir     maMenuHighlightTextColor( rData.maMenuHighlightTextColor ),
484*cdf0e10cSrcweir     maMenuTextColor( rData.maMenuTextColor ),
485*cdf0e10cSrcweir     maMenuBarTextColor( rData.maMenuBarTextColor ),
486*cdf0e10cSrcweir     maMonoColor( rData.maMonoColor ),
487*cdf0e10cSrcweir     maRadioCheckTextColor( rData.maRadioCheckTextColor ),
488*cdf0e10cSrcweir     maShadowColor( rData.maShadowColor ),
489*cdf0e10cSrcweir     maVisitedLinkColor( rData.maVisitedLinkColor ),
490*cdf0e10cSrcweir     maWindowColor( rData.maWindowColor ),
491*cdf0e10cSrcweir     maWindowTextColor( rData.maWindowTextColor ),
492*cdf0e10cSrcweir     maWorkspaceColor( rData.maWorkspaceColor ),
493*cdf0e10cSrcweir     maActiveTabColor( rData.maActiveTabColor ),
494*cdf0e10cSrcweir     maInactiveTabColor( rData.maInactiveTabColor ),
495*cdf0e10cSrcweir     maAppFont( rData.maAppFont ),
496*cdf0e10cSrcweir     maHelpFont( rData.maAppFont ),
497*cdf0e10cSrcweir     maTitleFont( rData.maTitleFont ),
498*cdf0e10cSrcweir     maFloatTitleFont( rData.maFloatTitleFont ),
499*cdf0e10cSrcweir     maMenuFont( rData.maMenuFont ),
500*cdf0e10cSrcweir     maToolFont( rData.maToolFont ),
501*cdf0e10cSrcweir     maLabelFont( rData.maLabelFont ),
502*cdf0e10cSrcweir     maInfoFont( rData.maInfoFont ),
503*cdf0e10cSrcweir     maRadioCheckFont( rData.maRadioCheckFont ),
504*cdf0e10cSrcweir     maPushButtonFont( rData.maPushButtonFont ),
505*cdf0e10cSrcweir     maFieldFont( rData.maFieldFont ),
506*cdf0e10cSrcweir     maIconFont( rData.maIconFont ),
507*cdf0e10cSrcweir     maGroupFont( rData.maGroupFont ),
508*cdf0e10cSrcweir     maWorkspaceGradient( rData.maWorkspaceGradient )
509*cdf0e10cSrcweir {
510*cdf0e10cSrcweir     mnRefCount                  = 1;
511*cdf0e10cSrcweir     mnBorderSize                = rData.mnBorderSize;
512*cdf0e10cSrcweir     mnTitleHeight               = rData.mnTitleHeight;
513*cdf0e10cSrcweir     mnFloatTitleHeight          = rData.mnFloatTitleHeight;
514*cdf0e10cSrcweir     mnTearOffTitleHeight        = rData.mnTearOffTitleHeight;
515*cdf0e10cSrcweir     mnMenuBarHeight             = rData.mnMenuBarHeight;
516*cdf0e10cSrcweir     mnScrollBarSize             = rData.mnScrollBarSize;
517*cdf0e10cSrcweir     mnMinThumbSize              = rData.mnMinThumbSize;
518*cdf0e10cSrcweir     mnSplitSize                 = rData.mnSplitSize;
519*cdf0e10cSrcweir     mnSpinSize                  = rData.mnSpinSize;
520*cdf0e10cSrcweir     mnIconHorzSpace             = rData.mnIconHorzSpace;
521*cdf0e10cSrcweir     mnIconVertSpace             = rData.mnIconVertSpace;
522*cdf0e10cSrcweir     mnAntialiasedMin            = rData.mnAntialiasedMin;
523*cdf0e10cSrcweir     mnCursorSize                = rData.mnCursorSize;
524*cdf0e10cSrcweir     mnCursorBlinkTime           = rData.mnCursorBlinkTime;
525*cdf0e10cSrcweir     mnScreenZoom                = rData.mnScreenZoom;
526*cdf0e10cSrcweir     mnScreenFontZoom            = rData.mnScreenFontZoom;
527*cdf0e10cSrcweir     mnLogoDisplayTime           = rData.mnLogoDisplayTime;
528*cdf0e10cSrcweir     mnDragFullOptions           = rData.mnDragFullOptions;
529*cdf0e10cSrcweir     mnAnimationOptions          = rData.mnAnimationOptions;
530*cdf0e10cSrcweir     mnSelectionOptions          = rData.mnSelectionOptions;
531*cdf0e10cSrcweir     mnDisplayOptions            = rData.mnDisplayOptions;
532*cdf0e10cSrcweir     mnOptions                   = rData.mnOptions;
533*cdf0e10cSrcweir 	mnHighContrast				= rData.mnHighContrast;
534*cdf0e10cSrcweir 	mnUseSystemUIFonts			= rData.mnUseSystemUIFonts;
535*cdf0e10cSrcweir 	mnUseFlatBorders 			= rData.mnUseFlatBorders;
536*cdf0e10cSrcweir 	mnUseFlatMenues 			= rData.mnUseFlatMenues;
537*cdf0e10cSrcweir     mnAutoMnemonic				= rData.mnAutoMnemonic;
538*cdf0e10cSrcweir     mnUseImagesInMenus			= rData.mnUseImagesInMenus;
539*cdf0e10cSrcweir     mnSkipDisabledInMenus		= rData.mnSkipDisabledInMenus;
540*cdf0e10cSrcweir     mnToolbarIconSize			= rData.mnToolbarIconSize;
541*cdf0e10cSrcweir     mnSymbolsStyle				= rData.mnSymbolsStyle;
542*cdf0e10cSrcweir     mnPreferredSymbolsStyle			= rData.mnPreferredSymbolsStyle;
543*cdf0e10cSrcweir     mpFontOptions               = rData.mpFontOptions;
544*cdf0e10cSrcweir }
545*cdf0e10cSrcweir 
546*cdf0e10cSrcweir // -----------------------------------------------------------------------
547*cdf0e10cSrcweir 
548*cdf0e10cSrcweir void ImplStyleData::SetStandardStyles()
549*cdf0e10cSrcweir {
550*cdf0e10cSrcweir     Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
551*cdf0e10cSrcweir     aStdFont.SetCharSet( gsl_getSystemTextEncoding() );
552*cdf0e10cSrcweir     aStdFont.SetWeight( WEIGHT_NORMAL );
553*cdf0e10cSrcweir     aStdFont.SetName( utl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) );
554*cdf0e10cSrcweir     maAppFont                   = aStdFont;
555*cdf0e10cSrcweir     maHelpFont                  = aStdFont;
556*cdf0e10cSrcweir     maMenuFont                  = aStdFont;
557*cdf0e10cSrcweir     maToolFont                  = aStdFont;
558*cdf0e10cSrcweir     maGroupFont                 = aStdFont;
559*cdf0e10cSrcweir     maLabelFont                 = aStdFont;
560*cdf0e10cSrcweir     maInfoFont                  = aStdFont;
561*cdf0e10cSrcweir     maRadioCheckFont            = aStdFont;
562*cdf0e10cSrcweir     maPushButtonFont            = aStdFont;
563*cdf0e10cSrcweir     maFieldFont                 = aStdFont;
564*cdf0e10cSrcweir     maIconFont                  = aStdFont;
565*cdf0e10cSrcweir     maFloatTitleFont            = aStdFont;
566*cdf0e10cSrcweir     aStdFont.SetWeight( WEIGHT_BOLD );
567*cdf0e10cSrcweir     maTitleFont                 = aStdFont;
568*cdf0e10cSrcweir 
569*cdf0e10cSrcweir     maFaceColor                 = Color( COL_LIGHTGRAY );
570*cdf0e10cSrcweir     maCheckedColor              = Color( 0xCC, 0xCC, 0xCC );
571*cdf0e10cSrcweir     maLightColor                = Color( COL_WHITE );
572*cdf0e10cSrcweir     maLightBorderColor          = Color( COL_LIGHTGRAY );
573*cdf0e10cSrcweir     maShadowColor               = Color( COL_GRAY );
574*cdf0e10cSrcweir     maDarkShadowColor           = Color( COL_BLACK );
575*cdf0e10cSrcweir     maButtonTextColor           = Color( COL_BLACK );
576*cdf0e10cSrcweir     maButtonRolloverTextColor   = Color( COL_BLACK );
577*cdf0e10cSrcweir     maRadioCheckTextColor       = Color( COL_BLACK );
578*cdf0e10cSrcweir     maGroupTextColor            = Color( COL_BLACK );
579*cdf0e10cSrcweir     maLabelTextColor            = Color( COL_BLACK );
580*cdf0e10cSrcweir     maInfoTextColor             = Color( COL_BLACK );
581*cdf0e10cSrcweir     maWindowColor               = Color( COL_WHITE );
582*cdf0e10cSrcweir     maWindowTextColor           = Color( COL_BLACK );
583*cdf0e10cSrcweir     maDialogColor               = Color( COL_LIGHTGRAY );
584*cdf0e10cSrcweir     maDialogTextColor           = Color( COL_BLACK );
585*cdf0e10cSrcweir     maWorkspaceColor            = Color( COL_GRAY );
586*cdf0e10cSrcweir     maMonoColor                 = Color( COL_BLACK );
587*cdf0e10cSrcweir     maFieldColor                = Color( COL_WHITE );
588*cdf0e10cSrcweir     maFieldTextColor            = Color( COL_BLACK );
589*cdf0e10cSrcweir     maFieldRolloverTextColor    = Color( COL_BLACK );
590*cdf0e10cSrcweir     maActiveColor               = Color( COL_BLUE );
591*cdf0e10cSrcweir     maActiveColor2              = Color( COL_BLACK );
592*cdf0e10cSrcweir     maActiveTextColor           = Color( COL_WHITE );
593*cdf0e10cSrcweir     maActiveBorderColor         = Color( COL_LIGHTGRAY );
594*cdf0e10cSrcweir     maDeactiveColor             = Color( COL_GRAY );
595*cdf0e10cSrcweir     maDeactiveColor2            = Color( COL_BLACK );
596*cdf0e10cSrcweir     maDeactiveTextColor         = Color( COL_LIGHTGRAY );
597*cdf0e10cSrcweir     maDeactiveBorderColor       = Color( COL_LIGHTGRAY );
598*cdf0e10cSrcweir     maMenuColor                 = Color( COL_LIGHTGRAY );
599*cdf0e10cSrcweir     maMenuBarColor              = Color( COL_LIGHTGRAY );
600*cdf0e10cSrcweir     maMenuBorderColor           = Color( COL_LIGHTGRAY );
601*cdf0e10cSrcweir     maMenuTextColor             = Color( COL_BLACK );
602*cdf0e10cSrcweir     maMenuBarTextColor          = Color( COL_BLACK );
603*cdf0e10cSrcweir     maMenuHighlightColor        = Color( COL_BLUE );
604*cdf0e10cSrcweir     maMenuHighlightTextColor    = Color( COL_WHITE );
605*cdf0e10cSrcweir     maHighlightColor            = Color( COL_BLUE );
606*cdf0e10cSrcweir     maHighlightTextColor        = Color( COL_WHITE );
607*cdf0e10cSrcweir     maActiveTabColor            = Color( COL_WHITE );
608*cdf0e10cSrcweir     maInactiveTabColor          = Color( COL_LIGHTGRAY );
609*cdf0e10cSrcweir     maDisableColor              = Color( COL_GRAY );
610*cdf0e10cSrcweir     maHelpColor                 = Color( 0xFF, 0xFF, 0xE0 );
611*cdf0e10cSrcweir     maHelpTextColor             = Color( COL_BLACK );
612*cdf0e10cSrcweir     maLinkColor                 = Color( COL_BLUE );
613*cdf0e10cSrcweir     maVisitedLinkColor          = Color( 0x00, 0x00, 0xCC );
614*cdf0e10cSrcweir     maHighlightLinkColor        = Color( COL_LIGHTBLUE );
615*cdf0e10cSrcweir 	maFontColor					= Color( COL_BLACK );
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir     mnBorderSize                = 1;
618*cdf0e10cSrcweir     mnTitleHeight               = 18;
619*cdf0e10cSrcweir     mnFloatTitleHeight          = 13;
620*cdf0e10cSrcweir     mnTearOffTitleHeight        = 8;
621*cdf0e10cSrcweir     mnMenuBarHeight             = 14;
622*cdf0e10cSrcweir 	mnHighContrast				= 0;
623*cdf0e10cSrcweir 	mnUseSystemUIFonts			= 1;
624*cdf0e10cSrcweir 	mnUseFlatBorders 			= 0;
625*cdf0e10cSrcweir 	mnUseFlatMenues 			= 0;
626*cdf0e10cSrcweir 	mnUseImagesInMenus			= (sal_uInt16)sal_True;
627*cdf0e10cSrcweir 	mnSkipDisabledInMenus		= (sal_uInt16)sal_False;
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir     Gradient aGrad( GRADIENT_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR );
630*cdf0e10cSrcweir     maWorkspaceGradient = Wallpaper( aGrad );
631*cdf0e10cSrcweir }
632*cdf0e10cSrcweir 
633*cdf0e10cSrcweir // -----------------------------------------------------------------------
634*cdf0e10cSrcweir 
635*cdf0e10cSrcweir StyleSettings::StyleSettings()
636*cdf0e10cSrcweir {
637*cdf0e10cSrcweir     mpData = new ImplStyleData();
638*cdf0e10cSrcweir }
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir // -----------------------------------------------------------------------
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir StyleSettings::StyleSettings( const StyleSettings& rSet )
643*cdf0e10cSrcweir {
644*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "StyleSettings: RefCount overflow" );
645*cdf0e10cSrcweir 
646*cdf0e10cSrcweir     // shared Instance Daten uebernehmen und Referenzcounter erhoehen
647*cdf0e10cSrcweir     mpData = rSet.mpData;
648*cdf0e10cSrcweir     mpData->mnRefCount++;
649*cdf0e10cSrcweir }
650*cdf0e10cSrcweir 
651*cdf0e10cSrcweir // -----------------------------------------------------------------------
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir StyleSettings::~StyleSettings()
654*cdf0e10cSrcweir {
655*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
656*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
657*cdf0e10cSrcweir         delete mpData;
658*cdf0e10cSrcweir     else
659*cdf0e10cSrcweir         mpData->mnRefCount--;
660*cdf0e10cSrcweir }
661*cdf0e10cSrcweir 
662*cdf0e10cSrcweir // -----------------------------------------------------------------------
663*cdf0e10cSrcweir 
664*cdf0e10cSrcweir void StyleSettings::Set3DColors( const Color& rColor )
665*cdf0e10cSrcweir {
666*cdf0e10cSrcweir     CopyData();
667*cdf0e10cSrcweir     mpData->maFaceColor         = rColor;
668*cdf0e10cSrcweir     mpData->maLightBorderColor  = rColor;
669*cdf0e10cSrcweir     mpData->maMenuBorderColor   = rColor;
670*cdf0e10cSrcweir     mpData->maDarkShadowColor   = Color( COL_BLACK );
671*cdf0e10cSrcweir     if ( rColor != Color( COL_LIGHTGRAY ) )
672*cdf0e10cSrcweir     {
673*cdf0e10cSrcweir         mpData->maLightColor    = rColor;
674*cdf0e10cSrcweir         mpData->maShadowColor   = rColor;
675*cdf0e10cSrcweir         mpData->maLightColor.IncreaseLuminance( 64 );
676*cdf0e10cSrcweir         mpData->maShadowColor.DecreaseLuminance( 64 );
677*cdf0e10cSrcweir         sal_uLong   nRed    = mpData->maLightColor.GetRed();
678*cdf0e10cSrcweir         sal_uLong   nGreen  = mpData->maLightColor.GetGreen();
679*cdf0e10cSrcweir         sal_uLong   nBlue   = mpData->maLightColor.GetBlue();
680*cdf0e10cSrcweir         nRed   += (sal_uLong)(mpData->maShadowColor.GetRed());
681*cdf0e10cSrcweir         nGreen += (sal_uLong)(mpData->maShadowColor.GetGreen());
682*cdf0e10cSrcweir         nBlue  += (sal_uLong)(mpData->maShadowColor.GetBlue());
683*cdf0e10cSrcweir         mpData->maCheckedColor = Color( (sal_uInt8)(nRed/2), (sal_uInt8)(nGreen/2), (sal_uInt8)(nBlue/2) );
684*cdf0e10cSrcweir     }
685*cdf0e10cSrcweir     else
686*cdf0e10cSrcweir     {
687*cdf0e10cSrcweir         mpData->maCheckedColor  = Color( 0x99, 0x99, 0x99 );
688*cdf0e10cSrcweir         mpData->maLightColor    = Color( COL_WHITE );
689*cdf0e10cSrcweir         mpData->maShadowColor   = Color( COL_GRAY );
690*cdf0e10cSrcweir     }
691*cdf0e10cSrcweir }
692*cdf0e10cSrcweir 
693*cdf0e10cSrcweir // -----------------------------------------------------------------------
694*cdf0e10cSrcweir 
695*cdf0e10cSrcweir ::rtl::OUString StyleSettings::ImplSymbolsStyleToName( sal_uLong nStyle ) const
696*cdf0e10cSrcweir {
697*cdf0e10cSrcweir 	switch ( nStyle )
698*cdf0e10cSrcweir 	{
699*cdf0e10cSrcweir 		case STYLE_SYMBOLS_DEFAULT:    return ::rtl::OUString::createFromAscii( "default" );
700*cdf0e10cSrcweir 		case STYLE_SYMBOLS_HICONTRAST: return ::rtl::OUString::createFromAscii( "hicontrast" );
701*cdf0e10cSrcweir 		case STYLE_SYMBOLS_INDUSTRIAL: return ::rtl::OUString::createFromAscii( "industrial" );
702*cdf0e10cSrcweir 		case STYLE_SYMBOLS_CRYSTAL:    return ::rtl::OUString::createFromAscii( "crystal" );
703*cdf0e10cSrcweir 		case STYLE_SYMBOLS_TANGO:      return ::rtl::OUString::createFromAscii( "tango" );
704*cdf0e10cSrcweir 		case STYLE_SYMBOLS_OXYGEN:     return ::rtl::OUString::createFromAscii( "oxygen" );
705*cdf0e10cSrcweir 		case STYLE_SYMBOLS_CLASSIC:    return ::rtl::OUString::createFromAscii( "classic" );
706*cdf0e10cSrcweir 	}
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "auto" );
709*cdf0e10cSrcweir }
710*cdf0e10cSrcweir 
711*cdf0e10cSrcweir // -----------------------------------------------------------------------
712*cdf0e10cSrcweir 
713*cdf0e10cSrcweir sal_uLong StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) const
714*cdf0e10cSrcweir {
715*cdf0e10cSrcweir 	if ( rName == ::rtl::OUString::createFromAscii( "default" ) )
716*cdf0e10cSrcweir 		return STYLE_SYMBOLS_DEFAULT;
717*cdf0e10cSrcweir 	else if ( rName == ::rtl::OUString::createFromAscii( "hicontrast" ) )
718*cdf0e10cSrcweir 		return STYLE_SYMBOLS_HICONTRAST;
719*cdf0e10cSrcweir 	else if ( rName == ::rtl::OUString::createFromAscii( "industrial" ) )
720*cdf0e10cSrcweir 		return STYLE_SYMBOLS_INDUSTRIAL;
721*cdf0e10cSrcweir 	else if ( rName == ::rtl::OUString::createFromAscii( "crystal" ) )
722*cdf0e10cSrcweir 		return STYLE_SYMBOLS_CRYSTAL;
723*cdf0e10cSrcweir 	else if ( rName == ::rtl::OUString::createFromAscii( "tango" ) )
724*cdf0e10cSrcweir 		return STYLE_SYMBOLS_TANGO;
725*cdf0e10cSrcweir 	else if ( rName == ::rtl::OUString::createFromAscii( "oxygen" ) )
726*cdf0e10cSrcweir 		return STYLE_SYMBOLS_OXYGEN;
727*cdf0e10cSrcweir 	else if ( rName == ::rtl::OUString::createFromAscii( "classic" ) )
728*cdf0e10cSrcweir 		return STYLE_SYMBOLS_CLASSIC;
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir 	return STYLE_SYMBOLS_AUTO;
731*cdf0e10cSrcweir }
732*cdf0e10cSrcweir 
733*cdf0e10cSrcweir // -----------------------------------------------------------------------
734*cdf0e10cSrcweir 
735*cdf0e10cSrcweir /**
736*cdf0e10cSrcweir 	The preferred style name can be read from the desktop setting. We
737*cdf0e10cSrcweir 	need to find the closest theme name registered in OOo. Therefore
738*cdf0e10cSrcweir 	we check if any registered style name is a case-insensitive
739*cdf0e10cSrcweir 	substring of the preferred style name.
740*cdf0e10cSrcweir */
741*cdf0e10cSrcweir void StyleSettings::SetPreferredSymbolsStyleName( const ::rtl::OUString &rName )
742*cdf0e10cSrcweir {
743*cdf0e10cSrcweir 	if ( rName.getLength() > 0 )
744*cdf0e10cSrcweir 	{
745*cdf0e10cSrcweir 		::rtl::OUString rNameLowCase( rName.toAsciiLowerCase() );
746*cdf0e10cSrcweir 
747*cdf0e10cSrcweir 		for( sal_uInt32 n = 0; n <= STYLE_SYMBOLS_THEMES_MAX; n++ )
748*cdf0e10cSrcweir 			if ( rNameLowCase.indexOf( ImplSymbolsStyleToName( n ) ) != -1 )
749*cdf0e10cSrcweir 				SetPreferredSymbolsStyle( n );
750*cdf0e10cSrcweir 	}
751*cdf0e10cSrcweir }
752*cdf0e10cSrcweir 
753*cdf0e10cSrcweir // -----------------------------------------------------------------------
754*cdf0e10cSrcweir 
755*cdf0e10cSrcweir sal_uLong StyleSettings::GetCurrentSymbolsStyle() const
756*cdf0e10cSrcweir {
757*cdf0e10cSrcweir 	// style selected in Tools -> Options... -> OpenOffice.org -> View
758*cdf0e10cSrcweir 	sal_uLong nStyle = GetSymbolsStyle();
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir 	if ( nStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nStyle) ) )
761*cdf0e10cSrcweir 	{
762*cdf0e10cSrcweir 		// the preferred style can be read from the desktop setting by the desktop native widgets modules
763*cdf0e10cSrcweir 		sal_uLong nPreferredStyle = GetPreferredSymbolsStyle();
764*cdf0e10cSrcweir 
765*cdf0e10cSrcweir 		if ( nPreferredStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nPreferredStyle) ) )
766*cdf0e10cSrcweir 		{
767*cdf0e10cSrcweir 
768*cdf0e10cSrcweir 			// use a hardcoded desktop-specific fallback if no preferred style has been detected
769*cdf0e10cSrcweir 			static bool sbFallbackDesktopChecked = false;
770*cdf0e10cSrcweir 			static sal_uLong snFallbackDesktopStyle = STYLE_SYMBOLS_DEFAULT;
771*cdf0e10cSrcweir 
772*cdf0e10cSrcweir 			if ( !sbFallbackDesktopChecked )
773*cdf0e10cSrcweir 			{
774*cdf0e10cSrcweir 				snFallbackDesktopStyle = GetAutoSymbolsStyle();
775*cdf0e10cSrcweir 				sbFallbackDesktopChecked = true;
776*cdf0e10cSrcweir 			}
777*cdf0e10cSrcweir 
778*cdf0e10cSrcweir 			nPreferredStyle = snFallbackDesktopStyle;
779*cdf0e10cSrcweir 		}
780*cdf0e10cSrcweir 
781*cdf0e10cSrcweir 		if (GetHighContrastMode() && CheckSymbolStyle (STYLE_SYMBOLS_HICONTRAST) )
782*cdf0e10cSrcweir 		    nStyle = STYLE_SYMBOLS_HICONTRAST;
783*cdf0e10cSrcweir 		else
784*cdf0e10cSrcweir 		    nStyle = nPreferredStyle;
785*cdf0e10cSrcweir 	}
786*cdf0e10cSrcweir 
787*cdf0e10cSrcweir 	return nStyle;
788*cdf0e10cSrcweir }
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir // -----------------------------------------------------------------------
791*cdf0e10cSrcweir 
792*cdf0e10cSrcweir sal_uLong StyleSettings::GetAutoSymbolsStyle() const
793*cdf0e10cSrcweir {
794*cdf0e10cSrcweir     const ::rtl::OUString&      rDesktopEnvironment = Application::GetDesktopEnvironment();
795*cdf0e10cSrcweir     sal_uLong                       nRet = STYLE_SYMBOLS_DEFAULT;
796*cdf0e10cSrcweir     bool                        bCont = true;
797*cdf0e10cSrcweir 
798*cdf0e10cSrcweir     try
799*cdf0e10cSrcweir     {
800*cdf0e10cSrcweir         const ::com::sun::star::uno::Any aAny( ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::OPENSOURCECONTEXT ) );
801*cdf0e10cSrcweir         sal_Int32 nValue( 0 );
802*cdf0e10cSrcweir 
803*cdf0e10cSrcweir         aAny >>= nValue;
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir         if( 0 == nValue )
806*cdf0e10cSrcweir             bCont = false;
807*cdf0e10cSrcweir     }
808*cdf0e10cSrcweir     catch ( ::com::sun::star::uno::Exception& )
809*cdf0e10cSrcweir     {
810*cdf0e10cSrcweir     }
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir     if( bCont )
813*cdf0e10cSrcweir     {
814*cdf0e10cSrcweir         if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) )
815*cdf0e10cSrcweir             nRet = STYLE_SYMBOLS_TANGO;
816*cdf0e10cSrcweir         else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) )
817*cdf0e10cSrcweir             nRet = STYLE_SYMBOLS_CRYSTAL;
818*cdf0e10cSrcweir         else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) )
819*cdf0e10cSrcweir             nRet = STYLE_SYMBOLS_OXYGEN;
820*cdf0e10cSrcweir     }
821*cdf0e10cSrcweir 
822*cdf0e10cSrcweir     // falback to any existing style
823*cdf0e10cSrcweir     if ( ! CheckSymbolStyle (nRet) )
824*cdf0e10cSrcweir     {
825*cdf0e10cSrcweir         for ( sal_uLong n = 0 ; n <= STYLE_SYMBOLS_THEMES_MAX  ; n++ )
826*cdf0e10cSrcweir         {
827*cdf0e10cSrcweir             sal_uLong nStyleToCheck = n;
828*cdf0e10cSrcweir 
829*cdf0e10cSrcweir             // auto is not a real theme => can't be fallback
830*cdf0e10cSrcweir             if ( nStyleToCheck == STYLE_SYMBOLS_AUTO )
831*cdf0e10cSrcweir                 continue;
832*cdf0e10cSrcweir 
833*cdf0e10cSrcweir             // will check hicontrast in the end
834*cdf0e10cSrcweir             if ( nStyleToCheck == STYLE_SYMBOLS_HICONTRAST )
835*cdf0e10cSrcweir                 continue;
836*cdf0e10cSrcweir             if ( nStyleToCheck == STYLE_SYMBOLS_THEMES_MAX )
837*cdf0e10cSrcweir                 nStyleToCheck = STYLE_SYMBOLS_HICONTRAST;
838*cdf0e10cSrcweir 
839*cdf0e10cSrcweir             if ( CheckSymbolStyle ( nStyleToCheck ) )
840*cdf0e10cSrcweir             {
841*cdf0e10cSrcweir                 nRet = nStyleToCheck;
842*cdf0e10cSrcweir                 n = STYLE_SYMBOLS_THEMES_MAX;
843*cdf0e10cSrcweir             }
844*cdf0e10cSrcweir         }
845*cdf0e10cSrcweir     }
846*cdf0e10cSrcweir 
847*cdf0e10cSrcweir     return nRet;
848*cdf0e10cSrcweir }
849*cdf0e10cSrcweir 
850*cdf0e10cSrcweir // -----------------------------------------------------------------------
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir bool StyleSettings::CheckSymbolStyle( sal_uLong nStyle ) const
853*cdf0e10cSrcweir {
854*cdf0e10cSrcweir     static ImplImageTreeSingletonRef aImageTree;
855*cdf0e10cSrcweir     return aImageTree->checkStyle( ImplSymbolsStyleToName( nStyle ) );
856*cdf0e10cSrcweir }
857*cdf0e10cSrcweir 
858*cdf0e10cSrcweir // -----------------------------------------------------------------------
859*cdf0e10cSrcweir 
860*cdf0e10cSrcweir void StyleSettings::SetStandardStyles()
861*cdf0e10cSrcweir {
862*cdf0e10cSrcweir     CopyData();
863*cdf0e10cSrcweir     mpData->SetStandardStyles();
864*cdf0e10cSrcweir }
865*cdf0e10cSrcweir 
866*cdf0e10cSrcweir // -----------------------------------------------------------------------
867*cdf0e10cSrcweir 
868*cdf0e10cSrcweir Color StyleSettings::GetFaceGradientColor() const
869*cdf0e10cSrcweir {
870*cdf0e10cSrcweir     // compute a brighter face color that can be used in gradients
871*cdf0e10cSrcweir     // for a convex look (eg toolbars)
872*cdf0e10cSrcweir 
873*cdf0e10cSrcweir     sal_uInt16 h, s, b;
874*cdf0e10cSrcweir     GetFaceColor().RGBtoHSB( h, s, b );
875*cdf0e10cSrcweir     if( s > 1) s=1;
876*cdf0e10cSrcweir     if( b < 98) b=98;
877*cdf0e10cSrcweir     return Color( Color::HSBtoRGB( h, s, b ) );
878*cdf0e10cSrcweir }
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir // -----------------------------------------------------------------------
881*cdf0e10cSrcweir 
882*cdf0e10cSrcweir Color StyleSettings::GetSeparatorColor() const
883*cdf0e10cSrcweir {
884*cdf0e10cSrcweir     // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP)
885*cdf0e10cSrcweir     sal_uInt16 h, s, b;
886*cdf0e10cSrcweir     GetShadowColor().RGBtoHSB( h, s, b );
887*cdf0e10cSrcweir     b += b/4;
888*cdf0e10cSrcweir     s -= s/4;
889*cdf0e10cSrcweir     return Color( Color::HSBtoRGB( h, s, b ) );
890*cdf0e10cSrcweir }
891*cdf0e10cSrcweir 
892*cdf0e10cSrcweir // -----------------------------------------------------------------------
893*cdf0e10cSrcweir 
894*cdf0e10cSrcweir const StyleSettings& StyleSettings::operator =( const StyleSettings& rSet )
895*cdf0e10cSrcweir {
896*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "StyleSettings: RefCount overflow" );
897*cdf0e10cSrcweir 
898*cdf0e10cSrcweir     // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
899*cdf0e10cSrcweir     rSet.mpData->mnRefCount++;
900*cdf0e10cSrcweir 
901*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
902*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
903*cdf0e10cSrcweir         delete mpData;
904*cdf0e10cSrcweir     else
905*cdf0e10cSrcweir         mpData->mnRefCount--;
906*cdf0e10cSrcweir 
907*cdf0e10cSrcweir     mpData = rSet.mpData;
908*cdf0e10cSrcweir 
909*cdf0e10cSrcweir     return *this;
910*cdf0e10cSrcweir }
911*cdf0e10cSrcweir 
912*cdf0e10cSrcweir // -----------------------------------------------------------------------
913*cdf0e10cSrcweir 
914*cdf0e10cSrcweir void StyleSettings::CopyData()
915*cdf0e10cSrcweir {
916*cdf0e10cSrcweir     // Falls noch andere Referenzen bestehen, dann kopieren
917*cdf0e10cSrcweir     if ( mpData->mnRefCount != 1 )
918*cdf0e10cSrcweir     {
919*cdf0e10cSrcweir         mpData->mnRefCount--;
920*cdf0e10cSrcweir         mpData = new ImplStyleData( *mpData );
921*cdf0e10cSrcweir     }
922*cdf0e10cSrcweir }
923*cdf0e10cSrcweir 
924*cdf0e10cSrcweir // -----------------------------------------------------------------------
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir inline sal_Bool ImplIsBackOrWhite( const Color& rColor )
927*cdf0e10cSrcweir {
928*cdf0e10cSrcweir     sal_uInt8 nLuminance = rColor.GetLuminance();
929*cdf0e10cSrcweir     return ( nLuminance < 8 ) || ( nLuminance > 250 );
930*cdf0e10cSrcweir }
931*cdf0e10cSrcweir 
932*cdf0e10cSrcweir sal_Bool StyleSettings::IsHighContrastBlackAndWhite() const
933*cdf0e10cSrcweir {
934*cdf0e10cSrcweir     sal_Bool bBWOnly = sal_True;
935*cdf0e10cSrcweir 
936*cdf0e10cSrcweir     // Only use B&W if fully B&W, like on GNOME.
937*cdf0e10cSrcweir     // Some colors like CheckedColor and HighlightColor are not B&W in Windows Standard HC Black,
938*cdf0e10cSrcweir     // and we don't want to be B&W then, so check these color first, very probably not B&W.
939*cdf0e10cSrcweir 
940*cdf0e10cSrcweir     // Unfortunately, GNOME uses a very very dark color (0x000033) instead of BLACK (0x000000)
941*cdf0e10cSrcweir 
942*cdf0e10cSrcweir     if ( !ImplIsBackOrWhite( GetFaceColor() ) )
943*cdf0e10cSrcweir         bBWOnly = sal_False;
944*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetHighlightTextColor() ) )
945*cdf0e10cSrcweir         bBWOnly = sal_False;
946*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetWindowColor() ) )
947*cdf0e10cSrcweir         bBWOnly = sal_False;
948*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetWindowTextColor() ) )
949*cdf0e10cSrcweir         bBWOnly = sal_False;
950*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetButtonTextColor() ) )
951*cdf0e10cSrcweir         bBWOnly = sal_False;
952*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetButtonTextColor() ) )
953*cdf0e10cSrcweir         bBWOnly = sal_False;
954*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetGroupTextColor() ) )
955*cdf0e10cSrcweir         bBWOnly = sal_False;
956*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetLabelTextColor() ) )
957*cdf0e10cSrcweir         bBWOnly = sal_False;
958*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetDialogColor() ) )
959*cdf0e10cSrcweir         bBWOnly = sal_False;
960*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetFieldColor() ) )
961*cdf0e10cSrcweir         bBWOnly = sal_False;
962*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetMenuColor() ) )
963*cdf0e10cSrcweir         bBWOnly = sal_False;
964*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetMenuBarColor() ) )
965*cdf0e10cSrcweir         bBWOnly = sal_False;
966*cdf0e10cSrcweir     else if ( !ImplIsBackOrWhite( GetMenuHighlightColor() ) )
967*cdf0e10cSrcweir         bBWOnly = sal_False;
968*cdf0e10cSrcweir 
969*cdf0e10cSrcweir     return bBWOnly;
970*cdf0e10cSrcweir }
971*cdf0e10cSrcweir 
972*cdf0e10cSrcweir // -----------------------------------------------------------------------
973*cdf0e10cSrcweir 
974*cdf0e10cSrcweir sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const
975*cdf0e10cSrcweir {
976*cdf0e10cSrcweir     if ( mpData == rSet.mpData )
977*cdf0e10cSrcweir         return sal_True;
978*cdf0e10cSrcweir 
979*cdf0e10cSrcweir     if ( (mpData->mnOptions                 == rSet.mpData->mnOptions)                  &&
980*cdf0e10cSrcweir          (mpData->mnAutoMnemonic			== rSet.mpData->mnAutoMnemonic)				&&
981*cdf0e10cSrcweir          (mpData->mnLogoDisplayTime         == rSet.mpData->mnLogoDisplayTime)          &&
982*cdf0e10cSrcweir          (mpData->mnDragFullOptions         == rSet.mpData->mnDragFullOptions)          &&
983*cdf0e10cSrcweir          (mpData->mnAnimationOptions        == rSet.mpData->mnAnimationOptions)         &&
984*cdf0e10cSrcweir          (mpData->mnSelectionOptions        == rSet.mpData->mnSelectionOptions)         &&
985*cdf0e10cSrcweir          (mpData->mnDisplayOptions          == rSet.mpData->mnDisplayOptions)           &&
986*cdf0e10cSrcweir          (mpData->mnCursorSize              == rSet.mpData->mnCursorSize)               &&
987*cdf0e10cSrcweir          (mpData->mnCursorBlinkTime         == rSet.mpData->mnCursorBlinkTime)          &&
988*cdf0e10cSrcweir          (mpData->mnBorderSize              == rSet.mpData->mnBorderSize)               &&
989*cdf0e10cSrcweir          (mpData->mnTitleHeight             == rSet.mpData->mnTitleHeight)              &&
990*cdf0e10cSrcweir          (mpData->mnFloatTitleHeight        == rSet.mpData->mnFloatTitleHeight)         &&
991*cdf0e10cSrcweir          (mpData->mnTearOffTitleHeight      == rSet.mpData->mnTearOffTitleHeight)       &&
992*cdf0e10cSrcweir          (mpData->mnMenuBarHeight           == rSet.mpData->mnMenuBarHeight)            &&
993*cdf0e10cSrcweir          (mpData->mnScrollBarSize           == rSet.mpData->mnScrollBarSize)            &&
994*cdf0e10cSrcweir          (mpData->mnMinThumbSize            == rSet.mpData->mnMinThumbSize)             &&
995*cdf0e10cSrcweir          (mpData->mnSplitSize               == rSet.mpData->mnSplitSize)                &&
996*cdf0e10cSrcweir          (mpData->mnSpinSize                == rSet.mpData->mnSpinSize)                 &&
997*cdf0e10cSrcweir          (mpData->mnIconHorzSpace           == rSet.mpData->mnIconHorzSpace)            &&
998*cdf0e10cSrcweir          (mpData->mnIconVertSpace           == rSet.mpData->mnIconVertSpace)            &&
999*cdf0e10cSrcweir          (mpData->mnAntialiasedMin          == rSet.mpData->mnAntialiasedMin)           &&
1000*cdf0e10cSrcweir          (mpData->mnScreenZoom              == rSet.mpData->mnScreenZoom)               &&
1001*cdf0e10cSrcweir          (mpData->mnScreenFontZoom          == rSet.mpData->mnScreenFontZoom)           &&
1002*cdf0e10cSrcweir          (mpData->mnHighContrast			== rSet.mpData->mnHighContrast)             &&
1003*cdf0e10cSrcweir          (mpData->mnUseSystemUIFonts		== rSet.mpData->mnUseSystemUIFonts)         &&
1004*cdf0e10cSrcweir          (mpData->mnUseFlatBorders   		== rSet.mpData->mnUseFlatBorders)           &&
1005*cdf0e10cSrcweir          (mpData->mnUseFlatMenues   		== rSet.mpData->mnUseFlatMenues)            &&
1006*cdf0e10cSrcweir          (mpData->mnSymbolsStyle       		== rSet.mpData->mnSymbolsStyle)             &&
1007*cdf0e10cSrcweir          (mpData->mnPreferredSymbolsStyle   == rSet.mpData->mnPreferredSymbolsStyle)    &&
1008*cdf0e10cSrcweir          (mpData->maFaceColor               == rSet.mpData->maFaceColor)                &&
1009*cdf0e10cSrcweir          (mpData->maCheckedColor            == rSet.mpData->maCheckedColor)             &&
1010*cdf0e10cSrcweir          (mpData->maLightColor              == rSet.mpData->maLightColor)               &&
1011*cdf0e10cSrcweir          (mpData->maLightBorderColor        == rSet.mpData->maLightBorderColor)         &&
1012*cdf0e10cSrcweir          (mpData->maShadowColor             == rSet.mpData->maShadowColor)              &&
1013*cdf0e10cSrcweir          (mpData->maDarkShadowColor         == rSet.mpData->maDarkShadowColor)          &&
1014*cdf0e10cSrcweir          (mpData->maButtonTextColor         == rSet.mpData->maButtonTextColor)          &&
1015*cdf0e10cSrcweir          (mpData->maRadioCheckTextColor     == rSet.mpData->maRadioCheckTextColor)      &&
1016*cdf0e10cSrcweir          (mpData->maGroupTextColor          == rSet.mpData->maGroupTextColor)           &&
1017*cdf0e10cSrcweir          (mpData->maLabelTextColor          == rSet.mpData->maLabelTextColor)           &&
1018*cdf0e10cSrcweir          (mpData->maInfoTextColor           == rSet.mpData->maInfoTextColor)            &&
1019*cdf0e10cSrcweir          (mpData->maWindowColor             == rSet.mpData->maWindowColor)              &&
1020*cdf0e10cSrcweir          (mpData->maWindowTextColor         == rSet.mpData->maWindowTextColor)          &&
1021*cdf0e10cSrcweir          (mpData->maDialogColor             == rSet.mpData->maDialogColor)              &&
1022*cdf0e10cSrcweir          (mpData->maDialogTextColor         == rSet.mpData->maDialogTextColor)          &&
1023*cdf0e10cSrcweir          (mpData->maWorkspaceColor          == rSet.mpData->maWorkspaceColor)           &&
1024*cdf0e10cSrcweir          (mpData->maMonoColor               == rSet.mpData->maMonoColor)                &&
1025*cdf0e10cSrcweir          (mpData->maFieldColor              == rSet.mpData->maFieldColor)               &&
1026*cdf0e10cSrcweir          (mpData->maFieldTextColor          == rSet.mpData->maFieldTextColor)           &&
1027*cdf0e10cSrcweir          (mpData->maActiveColor             == rSet.mpData->maActiveColor)              &&
1028*cdf0e10cSrcweir          (mpData->maActiveColor2            == rSet.mpData->maActiveColor2)             &&
1029*cdf0e10cSrcweir          (mpData->maActiveTextColor         == rSet.mpData->maActiveTextColor)          &&
1030*cdf0e10cSrcweir          (mpData->maActiveBorderColor       == rSet.mpData->maActiveBorderColor)        &&
1031*cdf0e10cSrcweir          (mpData->maDeactiveColor           == rSet.mpData->maDeactiveColor)            &&
1032*cdf0e10cSrcweir          (mpData->maDeactiveColor2          == rSet.mpData->maDeactiveColor2)           &&
1033*cdf0e10cSrcweir          (mpData->maDeactiveTextColor       == rSet.mpData->maDeactiveTextColor)        &&
1034*cdf0e10cSrcweir          (mpData->maDeactiveBorderColor     == rSet.mpData->maDeactiveBorderColor)      &&
1035*cdf0e10cSrcweir          (mpData->maMenuColor               == rSet.mpData->maMenuColor)                &&
1036*cdf0e10cSrcweir          (mpData->maMenuBarColor            == rSet.mpData->maMenuBarColor)             &&
1037*cdf0e10cSrcweir          (mpData->maMenuBorderColor         == rSet.mpData->maMenuBorderColor)          &&
1038*cdf0e10cSrcweir          (mpData->maMenuTextColor           == rSet.mpData->maMenuTextColor)            &&
1039*cdf0e10cSrcweir          (mpData->maMenuBarTextColor        == rSet.mpData->maMenuBarTextColor)         &&
1040*cdf0e10cSrcweir          (mpData->maMenuHighlightColor      == rSet.mpData->maMenuHighlightColor)       &&
1041*cdf0e10cSrcweir          (mpData->maMenuHighlightTextColor  == rSet.mpData->maMenuHighlightTextColor)   &&
1042*cdf0e10cSrcweir          (mpData->maHighlightColor          == rSet.mpData->maHighlightColor)           &&
1043*cdf0e10cSrcweir          (mpData->maHighlightTextColor      == rSet.mpData->maHighlightTextColor)       &&
1044*cdf0e10cSrcweir          (mpData->maActiveTabColor          == rSet.mpData->maActiveTabColor)           &&
1045*cdf0e10cSrcweir          (mpData->maInactiveTabColor        == rSet.mpData->maInactiveTabColor)         &&
1046*cdf0e10cSrcweir          (mpData->maDisableColor            == rSet.mpData->maDisableColor)             &&
1047*cdf0e10cSrcweir          (mpData->maHelpColor               == rSet.mpData->maHelpColor)                &&
1048*cdf0e10cSrcweir          (mpData->maHelpTextColor           == rSet.mpData->maHelpTextColor)            &&
1049*cdf0e10cSrcweir          (mpData->maLinkColor               == rSet.mpData->maLinkColor)                &&
1050*cdf0e10cSrcweir          (mpData->maVisitedLinkColor        == rSet.mpData->maVisitedLinkColor)         &&
1051*cdf0e10cSrcweir          (mpData->maHighlightLinkColor      == rSet.mpData->maHighlightLinkColor)       &&
1052*cdf0e10cSrcweir          (mpData->maAppFont                 == rSet.mpData->maAppFont)                  &&
1053*cdf0e10cSrcweir          (mpData->maHelpFont                == rSet.mpData->maHelpFont)                 &&
1054*cdf0e10cSrcweir          (mpData->maTitleFont               == rSet.mpData->maTitleFont)                &&
1055*cdf0e10cSrcweir          (mpData->maFloatTitleFont          == rSet.mpData->maFloatTitleFont)           &&
1056*cdf0e10cSrcweir          (mpData->maMenuFont                == rSet.mpData->maMenuFont)                 &&
1057*cdf0e10cSrcweir          (mpData->maToolFont                == rSet.mpData->maToolFont)                 &&
1058*cdf0e10cSrcweir          (mpData->maGroupFont               == rSet.mpData->maGroupFont)                &&
1059*cdf0e10cSrcweir          (mpData->maLabelFont               == rSet.mpData->maLabelFont)                &&
1060*cdf0e10cSrcweir          (mpData->maInfoFont                == rSet.mpData->maInfoFont)                 &&
1061*cdf0e10cSrcweir          (mpData->maRadioCheckFont          == rSet.mpData->maRadioCheckFont)           &&
1062*cdf0e10cSrcweir          (mpData->maPushButtonFont          == rSet.mpData->maPushButtonFont)           &&
1063*cdf0e10cSrcweir          (mpData->maFieldFont               == rSet.mpData->maFieldFont)                &&
1064*cdf0e10cSrcweir          (mpData->maIconFont                == rSet.mpData->maIconFont)					&&
1065*cdf0e10cSrcweir          (mpData->mnUseImagesInMenus		== rSet.mpData->mnUseImagesInMenus)			&&
1066*cdf0e10cSrcweir          (mpData->mnSkipDisabledInMenus		== rSet.mpData->mnSkipDisabledInMenus)		&&
1067*cdf0e10cSrcweir 		 (mpData->maFontColor				== rSet.mpData->maFontColor ))
1068*cdf0e10cSrcweir         return sal_True;
1069*cdf0e10cSrcweir     else
1070*cdf0e10cSrcweir         return sal_False;
1071*cdf0e10cSrcweir }
1072*cdf0e10cSrcweir 
1073*cdf0e10cSrcweir // =======================================================================
1074*cdf0e10cSrcweir 
1075*cdf0e10cSrcweir ImplMiscData::ImplMiscData()
1076*cdf0e10cSrcweir {
1077*cdf0e10cSrcweir     mnRefCount                  = 1;
1078*cdf0e10cSrcweir     mnEnableATT					= sal::static_int_cast<sal_uInt16>(~0U);
1079*cdf0e10cSrcweir     mnDisablePrinting			= sal::static_int_cast<sal_uInt16>(~0U);
1080*cdf0e10cSrcweir     static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
1081*cdf0e10cSrcweir     mbEnableLocalizedDecimalSep = (pEnv != NULL) ? sal_True : sal_False;
1082*cdf0e10cSrcweir }
1083*cdf0e10cSrcweir 
1084*cdf0e10cSrcweir // -----------------------------------------------------------------------
1085*cdf0e10cSrcweir 
1086*cdf0e10cSrcweir ImplMiscData::ImplMiscData( const ImplMiscData& rData )
1087*cdf0e10cSrcweir {
1088*cdf0e10cSrcweir     mnRefCount                  = 1;
1089*cdf0e10cSrcweir     mnEnableATT					= rData.mnEnableATT;
1090*cdf0e10cSrcweir     mnDisablePrinting			= rData.mnDisablePrinting;
1091*cdf0e10cSrcweir     mbEnableLocalizedDecimalSep = rData.mbEnableLocalizedDecimalSep;
1092*cdf0e10cSrcweir }
1093*cdf0e10cSrcweir 
1094*cdf0e10cSrcweir // -----------------------------------------------------------------------
1095*cdf0e10cSrcweir 
1096*cdf0e10cSrcweir MiscSettings::MiscSettings()
1097*cdf0e10cSrcweir {
1098*cdf0e10cSrcweir     mpData = new ImplMiscData();
1099*cdf0e10cSrcweir }
1100*cdf0e10cSrcweir 
1101*cdf0e10cSrcweir // -----------------------------------------------------------------------
1102*cdf0e10cSrcweir 
1103*cdf0e10cSrcweir MiscSettings::MiscSettings( const MiscSettings& rSet )
1104*cdf0e10cSrcweir {
1105*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "MiscSettings: RefCount overflow" );
1106*cdf0e10cSrcweir 
1107*cdf0e10cSrcweir     // shared Instance Daten uebernehmen und Referenzcounter erhoehen
1108*cdf0e10cSrcweir     mpData = rSet.mpData;
1109*cdf0e10cSrcweir     mpData->mnRefCount++;
1110*cdf0e10cSrcweir }
1111*cdf0e10cSrcweir 
1112*cdf0e10cSrcweir // -----------------------------------------------------------------------
1113*cdf0e10cSrcweir 
1114*cdf0e10cSrcweir MiscSettings::~MiscSettings()
1115*cdf0e10cSrcweir {
1116*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
1117*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
1118*cdf0e10cSrcweir         delete mpData;
1119*cdf0e10cSrcweir     else
1120*cdf0e10cSrcweir         mpData->mnRefCount--;
1121*cdf0e10cSrcweir }
1122*cdf0e10cSrcweir 
1123*cdf0e10cSrcweir // -----------------------------------------------------------------------
1124*cdf0e10cSrcweir 
1125*cdf0e10cSrcweir const MiscSettings& MiscSettings::operator =( const MiscSettings& rSet )
1126*cdf0e10cSrcweir {
1127*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "MiscSettings: RefCount overflow" );
1128*cdf0e10cSrcweir 
1129*cdf0e10cSrcweir     // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
1130*cdf0e10cSrcweir     rSet.mpData->mnRefCount++;
1131*cdf0e10cSrcweir 
1132*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
1133*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
1134*cdf0e10cSrcweir         delete mpData;
1135*cdf0e10cSrcweir     else
1136*cdf0e10cSrcweir         mpData->mnRefCount--;
1137*cdf0e10cSrcweir 
1138*cdf0e10cSrcweir     mpData = rSet.mpData;
1139*cdf0e10cSrcweir 
1140*cdf0e10cSrcweir     return *this;
1141*cdf0e10cSrcweir }
1142*cdf0e10cSrcweir 
1143*cdf0e10cSrcweir // -----------------------------------------------------------------------
1144*cdf0e10cSrcweir 
1145*cdf0e10cSrcweir void MiscSettings::CopyData()
1146*cdf0e10cSrcweir {
1147*cdf0e10cSrcweir     // Falls noch andere Referenzen bestehen, dann kopieren
1148*cdf0e10cSrcweir     if ( mpData->mnRefCount != 1 )
1149*cdf0e10cSrcweir     {
1150*cdf0e10cSrcweir         mpData->mnRefCount--;
1151*cdf0e10cSrcweir         mpData = new ImplMiscData( *mpData );
1152*cdf0e10cSrcweir     }
1153*cdf0e10cSrcweir }
1154*cdf0e10cSrcweir 
1155*cdf0e10cSrcweir // -----------------------------------------------------------------------
1156*cdf0e10cSrcweir 
1157*cdf0e10cSrcweir sal_Bool MiscSettings::operator ==( const MiscSettings& rSet ) const
1158*cdf0e10cSrcweir {
1159*cdf0e10cSrcweir     if ( mpData == rSet.mpData )
1160*cdf0e10cSrcweir         return sal_True;
1161*cdf0e10cSrcweir 
1162*cdf0e10cSrcweir     if ( (mpData->mnEnableATT			== rSet.mpData->mnEnableATT ) &&
1163*cdf0e10cSrcweir          (mpData->mnDisablePrinting		== rSet.mpData->mnDisablePrinting ) &&
1164*cdf0e10cSrcweir          (mpData->mbEnableLocalizedDecimalSep == rSet.mpData->mbEnableLocalizedDecimalSep ) )
1165*cdf0e10cSrcweir         return sal_True;
1166*cdf0e10cSrcweir     else
1167*cdf0e10cSrcweir         return sal_False;
1168*cdf0e10cSrcweir }
1169*cdf0e10cSrcweir 
1170*cdf0e10cSrcweir // -----------------------------------------------------------------------
1171*cdf0e10cSrcweir 
1172*cdf0e10cSrcweir sal_Bool MiscSettings::GetDisablePrinting() const
1173*cdf0e10cSrcweir {
1174*cdf0e10cSrcweir     if( mpData->mnDisablePrinting == (sal_uInt16)~0 )
1175*cdf0e10cSrcweir     {
1176*cdf0e10cSrcweir         rtl::OUString aEnable =
1177*cdf0e10cSrcweir             vcl::SettingsConfigItem::get()->
1178*cdf0e10cSrcweir             getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DesktopManagement" ) ),
1179*cdf0e10cSrcweir                       rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisablePrinting" ) ) );
1180*cdf0e10cSrcweir         mpData->mnDisablePrinting = aEnable.equalsIgnoreAsciiCaseAscii( "true" ) ? 1 : 0;
1181*cdf0e10cSrcweir     }
1182*cdf0e10cSrcweir 
1183*cdf0e10cSrcweir     return (sal_Bool)mpData->mnDisablePrinting;
1184*cdf0e10cSrcweir }
1185*cdf0e10cSrcweir // -----------------------------------------------------------------------
1186*cdf0e10cSrcweir 
1187*cdf0e10cSrcweir sal_Bool MiscSettings::GetEnableATToolSupport() const
1188*cdf0e10cSrcweir {
1189*cdf0e10cSrcweir 
1190*cdf0e10cSrcweir #ifdef WNT
1191*cdf0e10cSrcweir     if( mpData->mnEnableATT == (sal_uInt16)~0 )
1192*cdf0e10cSrcweir     {
1193*cdf0e10cSrcweir         // Check in the Windows registry if an AT tool wants Accessibility support to
1194*cdf0e10cSrcweir         // be activated ..
1195*cdf0e10cSrcweir         HKEY hkey;
1196*cdf0e10cSrcweir 
1197*cdf0e10cSrcweir         if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,
1198*cdf0e10cSrcweir             "Software\\OpenOffice.org\\Accessibility\\AtToolSupport",
1199*cdf0e10cSrcweir             &hkey) )
1200*cdf0e10cSrcweir         {
1201*cdf0e10cSrcweir             DWORD dwType;
1202*cdf0e10cSrcweir             sal_uInt8 Data[6]; // possible values: "true", "false", "1", "0", DWORD
1203*cdf0e10cSrcweir             DWORD cbData = sizeof(Data);
1204*cdf0e10cSrcweir 
1205*cdf0e10cSrcweir             if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
1206*cdf0e10cSrcweir                 NULL, &dwType, Data, &cbData) )
1207*cdf0e10cSrcweir             {
1208*cdf0e10cSrcweir                 switch (dwType)
1209*cdf0e10cSrcweir                 {
1210*cdf0e10cSrcweir                     case REG_SZ:
1211*cdf0e10cSrcweir                         mpData->mnEnableATT = ((0 == stricmp((const char *) Data, "1")) || (0 == stricmp((const char *) Data, "true")));
1212*cdf0e10cSrcweir                         break;
1213*cdf0e10cSrcweir                     case REG_DWORD:
1214*cdf0e10cSrcweir                         mpData->mnEnableATT = (sal_uInt16) (((DWORD *) Data)[0]);
1215*cdf0e10cSrcweir                         break;
1216*cdf0e10cSrcweir                     default:
1217*cdf0e10cSrcweir                         // Unsupported registry type
1218*cdf0e10cSrcweir                         break;
1219*cdf0e10cSrcweir                 }
1220*cdf0e10cSrcweir             }
1221*cdf0e10cSrcweir 
1222*cdf0e10cSrcweir             RegCloseKey(hkey);
1223*cdf0e10cSrcweir         }
1224*cdf0e10cSrcweir     }
1225*cdf0e10cSrcweir #endif
1226*cdf0e10cSrcweir 
1227*cdf0e10cSrcweir 	if( mpData->mnEnableATT == (sal_uInt16)~0 )
1228*cdf0e10cSrcweir     {
1229*cdf0e10cSrcweir         static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" );
1230*cdf0e10cSrcweir         if( !pEnv || !*pEnv )
1231*cdf0e10cSrcweir         {
1232*cdf0e10cSrcweir             rtl::OUString aEnable =
1233*cdf0e10cSrcweir                 vcl::SettingsConfigItem::get()->
1234*cdf0e10cSrcweir                 getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Accessibility" ) ),
1235*cdf0e10cSrcweir                           rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableATToolSupport" ) ) );
1236*cdf0e10cSrcweir             mpData->mnEnableATT = aEnable.equalsIgnoreAsciiCaseAscii( "true" ) ? 1 : 0;
1237*cdf0e10cSrcweir         }
1238*cdf0e10cSrcweir         else
1239*cdf0e10cSrcweir         {
1240*cdf0e10cSrcweir             mpData->mnEnableATT = 1;
1241*cdf0e10cSrcweir         }
1242*cdf0e10cSrcweir     }
1243*cdf0e10cSrcweir 
1244*cdf0e10cSrcweir     return (sal_Bool)mpData->mnEnableATT;
1245*cdf0e10cSrcweir }
1246*cdf0e10cSrcweir 
1247*cdf0e10cSrcweir // -----------------------------------------------------------------------
1248*cdf0e10cSrcweir 
1249*cdf0e10cSrcweir void MiscSettings::SetDisablePrinting( sal_Bool bEnable )
1250*cdf0e10cSrcweir {
1251*cdf0e10cSrcweir     if ( bEnable != mpData->mnDisablePrinting )
1252*cdf0e10cSrcweir     {
1253*cdf0e10cSrcweir         vcl::SettingsConfigItem::get()->
1254*cdf0e10cSrcweir             setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DesktopManagement" ) ),
1255*cdf0e10cSrcweir                       rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisablePrinting" ) ),
1256*cdf0e10cSrcweir                       rtl::OUString::createFromAscii( bEnable ? "true" : "false" ) );
1257*cdf0e10cSrcweir         mpData->mnDisablePrinting = bEnable ? 1 : 0;
1258*cdf0e10cSrcweir     }
1259*cdf0e10cSrcweir }
1260*cdf0e10cSrcweir 
1261*cdf0e10cSrcweir // -----------------------------------------------------------------------
1262*cdf0e10cSrcweir 
1263*cdf0e10cSrcweir void MiscSettings::SetEnableATToolSupport( sal_Bool bEnable )
1264*cdf0e10cSrcweir {
1265*cdf0e10cSrcweir     if ( bEnable != mpData->mnEnableATT )
1266*cdf0e10cSrcweir     {
1267*cdf0e10cSrcweir         sal_Bool bDummy;
1268*cdf0e10cSrcweir         if( bEnable && !ImplInitAccessBridge(false, bDummy) )
1269*cdf0e10cSrcweir             return;
1270*cdf0e10cSrcweir 
1271*cdf0e10cSrcweir #ifdef WNT
1272*cdf0e10cSrcweir 		HKEY hkey;
1273*cdf0e10cSrcweir 
1274*cdf0e10cSrcweir         // If the accessibility key in the Windows registry exists, change it synchronously
1275*cdf0e10cSrcweir 		if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,
1276*cdf0e10cSrcweir 			"Software\\OpenOffice.org\\Accessibility\\AtToolSupport",
1277*cdf0e10cSrcweir 			&hkey) )
1278*cdf0e10cSrcweir 		{
1279*cdf0e10cSrcweir 			DWORD dwType;
1280*cdf0e10cSrcweir 			sal_uInt8 Data[6]; // possible values: "true", "false", 1, 0
1281*cdf0e10cSrcweir 			DWORD cbData = sizeof(Data);
1282*cdf0e10cSrcweir 
1283*cdf0e10cSrcweir 			if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
1284*cdf0e10cSrcweir 				NULL,	&dwType, Data, &cbData) )
1285*cdf0e10cSrcweir 			{
1286*cdf0e10cSrcweir 				switch (dwType)
1287*cdf0e10cSrcweir 				{
1288*cdf0e10cSrcweir 					case REG_SZ:
1289*cdf0e10cSrcweir 						RegSetValueEx(hkey, "SupportAssistiveTechnology",
1290*cdf0e10cSrcweir 							NULL, dwType,
1291*cdf0e10cSrcweir 							bEnable ? (sal_uInt8 *) "true" : (sal_uInt8 *) "false",
1292*cdf0e10cSrcweir 							bEnable ? sizeof("true") : sizeof("false"));
1293*cdf0e10cSrcweir 						break;
1294*cdf0e10cSrcweir 					case REG_DWORD:
1295*cdf0e10cSrcweir 						((DWORD *) Data)[0] = bEnable ? 1 : 0;
1296*cdf0e10cSrcweir 						RegSetValueEx(hkey, "SupportAssistiveTechnology",
1297*cdf0e10cSrcweir 							NULL, dwType, Data,	sizeof(DWORD));
1298*cdf0e10cSrcweir 						break;
1299*cdf0e10cSrcweir 					default:
1300*cdf0e10cSrcweir 						// Unsupported registry type
1301*cdf0e10cSrcweir 						break;
1302*cdf0e10cSrcweir 				}
1303*cdf0e10cSrcweir 			}
1304*cdf0e10cSrcweir 
1305*cdf0e10cSrcweir 			RegCloseKey(hkey);
1306*cdf0e10cSrcweir         }
1307*cdf0e10cSrcweir 
1308*cdf0e10cSrcweir #endif
1309*cdf0e10cSrcweir         vcl::SettingsConfigItem::get()->
1310*cdf0e10cSrcweir             setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Accessibility" ) ),
1311*cdf0e10cSrcweir                       rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableATToolSupport" ) ),
1312*cdf0e10cSrcweir                       rtl::OUString::createFromAscii( bEnable ? "true" : "false" ) );
1313*cdf0e10cSrcweir         mpData->mnEnableATT = bEnable ? 1 : 0;
1314*cdf0e10cSrcweir     }
1315*cdf0e10cSrcweir }
1316*cdf0e10cSrcweir 
1317*cdf0e10cSrcweir void MiscSettings::SetEnableLocalizedDecimalSep( sal_Bool bEnable )
1318*cdf0e10cSrcweir {
1319*cdf0e10cSrcweir     CopyData();
1320*cdf0e10cSrcweir     mpData->mbEnableLocalizedDecimalSep = bEnable;
1321*cdf0e10cSrcweir }
1322*cdf0e10cSrcweir 
1323*cdf0e10cSrcweir sal_Bool MiscSettings::GetEnableLocalizedDecimalSep() const
1324*cdf0e10cSrcweir {
1325*cdf0e10cSrcweir     return mpData->mbEnableLocalizedDecimalSep;
1326*cdf0e10cSrcweir }
1327*cdf0e10cSrcweir 
1328*cdf0e10cSrcweir // =======================================================================
1329*cdf0e10cSrcweir 
1330*cdf0e10cSrcweir ImplNotificationData::ImplNotificationData()
1331*cdf0e10cSrcweir {
1332*cdf0e10cSrcweir     mnRefCount                  = 1;
1333*cdf0e10cSrcweir     mnOptions                   = 0;
1334*cdf0e10cSrcweir }
1335*cdf0e10cSrcweir 
1336*cdf0e10cSrcweir // -----------------------------------------------------------------------
1337*cdf0e10cSrcweir 
1338*cdf0e10cSrcweir ImplNotificationData::ImplNotificationData( const ImplNotificationData& rData )
1339*cdf0e10cSrcweir {
1340*cdf0e10cSrcweir     mnRefCount                  = 1;
1341*cdf0e10cSrcweir     mnOptions                   = rData.mnOptions;
1342*cdf0e10cSrcweir }
1343*cdf0e10cSrcweir 
1344*cdf0e10cSrcweir // -----------------------------------------------------------------------
1345*cdf0e10cSrcweir 
1346*cdf0e10cSrcweir NotificationSettings::NotificationSettings()
1347*cdf0e10cSrcweir {
1348*cdf0e10cSrcweir     mpData = new ImplNotificationData();
1349*cdf0e10cSrcweir }
1350*cdf0e10cSrcweir 
1351*cdf0e10cSrcweir // -----------------------------------------------------------------------
1352*cdf0e10cSrcweir 
1353*cdf0e10cSrcweir NotificationSettings::NotificationSettings( const NotificationSettings& rSet )
1354*cdf0e10cSrcweir {
1355*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "NotificationSettings: RefCount overflow" );
1356*cdf0e10cSrcweir 
1357*cdf0e10cSrcweir     // shared Instance Daten uebernehmen und Referenzcounter erhoehen
1358*cdf0e10cSrcweir     mpData = rSet.mpData;
1359*cdf0e10cSrcweir     mpData->mnRefCount++;
1360*cdf0e10cSrcweir }
1361*cdf0e10cSrcweir 
1362*cdf0e10cSrcweir // -----------------------------------------------------------------------
1363*cdf0e10cSrcweir 
1364*cdf0e10cSrcweir NotificationSettings::~NotificationSettings()
1365*cdf0e10cSrcweir {
1366*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
1367*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
1368*cdf0e10cSrcweir         delete mpData;
1369*cdf0e10cSrcweir     else
1370*cdf0e10cSrcweir         mpData->mnRefCount--;
1371*cdf0e10cSrcweir }
1372*cdf0e10cSrcweir 
1373*cdf0e10cSrcweir // -----------------------------------------------------------------------
1374*cdf0e10cSrcweir 
1375*cdf0e10cSrcweir const NotificationSettings& NotificationSettings::operator =( const NotificationSettings& rSet )
1376*cdf0e10cSrcweir {
1377*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "NotificationSettings: RefCount overflow" );
1378*cdf0e10cSrcweir 
1379*cdf0e10cSrcweir     // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
1380*cdf0e10cSrcweir     rSet.mpData->mnRefCount++;
1381*cdf0e10cSrcweir 
1382*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
1383*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
1384*cdf0e10cSrcweir         delete mpData;
1385*cdf0e10cSrcweir     else
1386*cdf0e10cSrcweir         mpData->mnRefCount--;
1387*cdf0e10cSrcweir 
1388*cdf0e10cSrcweir     mpData = rSet.mpData;
1389*cdf0e10cSrcweir 
1390*cdf0e10cSrcweir     return *this;
1391*cdf0e10cSrcweir }
1392*cdf0e10cSrcweir 
1393*cdf0e10cSrcweir // -----------------------------------------------------------------------
1394*cdf0e10cSrcweir 
1395*cdf0e10cSrcweir void NotificationSettings::CopyData()
1396*cdf0e10cSrcweir {
1397*cdf0e10cSrcweir     // Falls noch andere Referenzen bestehen, dann kopieren
1398*cdf0e10cSrcweir     if ( mpData->mnRefCount != 1 )
1399*cdf0e10cSrcweir     {
1400*cdf0e10cSrcweir         mpData->mnRefCount--;
1401*cdf0e10cSrcweir         mpData = new ImplNotificationData( *mpData );
1402*cdf0e10cSrcweir     }
1403*cdf0e10cSrcweir }
1404*cdf0e10cSrcweir 
1405*cdf0e10cSrcweir // -----------------------------------------------------------------------
1406*cdf0e10cSrcweir 
1407*cdf0e10cSrcweir sal_Bool NotificationSettings::operator ==( const NotificationSettings& rSet ) const
1408*cdf0e10cSrcweir {
1409*cdf0e10cSrcweir     if ( mpData == rSet.mpData )
1410*cdf0e10cSrcweir         return sal_True;
1411*cdf0e10cSrcweir 
1412*cdf0e10cSrcweir     if ( (mpData->mnOptions             == rSet.mpData->mnOptions) )
1413*cdf0e10cSrcweir         return sal_True;
1414*cdf0e10cSrcweir     else
1415*cdf0e10cSrcweir         return sal_False;
1416*cdf0e10cSrcweir }
1417*cdf0e10cSrcweir 
1418*cdf0e10cSrcweir // =======================================================================
1419*cdf0e10cSrcweir 
1420*cdf0e10cSrcweir ImplHelpData::ImplHelpData()
1421*cdf0e10cSrcweir {
1422*cdf0e10cSrcweir     mnRefCount                  = 1;
1423*cdf0e10cSrcweir     mnOptions                   = 0;
1424*cdf0e10cSrcweir     mnTipDelay                  = 500;
1425*cdf0e10cSrcweir     mnTipTimeout                = 3000;
1426*cdf0e10cSrcweir     mnBalloonDelay              = 1500;
1427*cdf0e10cSrcweir }
1428*cdf0e10cSrcweir 
1429*cdf0e10cSrcweir // -----------------------------------------------------------------------
1430*cdf0e10cSrcweir 
1431*cdf0e10cSrcweir ImplHelpData::ImplHelpData( const ImplHelpData& rData )
1432*cdf0e10cSrcweir {
1433*cdf0e10cSrcweir     mnRefCount                  = 1;
1434*cdf0e10cSrcweir     mnOptions                   = rData.mnOptions;
1435*cdf0e10cSrcweir     mnTipDelay                  = rData.mnTipDelay;
1436*cdf0e10cSrcweir     mnTipTimeout                = rData.mnTipTimeout;
1437*cdf0e10cSrcweir     mnBalloonDelay              = rData.mnBalloonDelay;
1438*cdf0e10cSrcweir }
1439*cdf0e10cSrcweir 
1440*cdf0e10cSrcweir // -----------------------------------------------------------------------
1441*cdf0e10cSrcweir 
1442*cdf0e10cSrcweir HelpSettings::HelpSettings()
1443*cdf0e10cSrcweir {
1444*cdf0e10cSrcweir     mpData = new ImplHelpData();
1445*cdf0e10cSrcweir }
1446*cdf0e10cSrcweir 
1447*cdf0e10cSrcweir // -----------------------------------------------------------------------
1448*cdf0e10cSrcweir 
1449*cdf0e10cSrcweir HelpSettings::HelpSettings( const HelpSettings& rSet )
1450*cdf0e10cSrcweir {
1451*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "HelpSettings: RefCount overflow" );
1452*cdf0e10cSrcweir 
1453*cdf0e10cSrcweir     // shared Instance Daten uebernehmen und Referenzcounter erhoehen
1454*cdf0e10cSrcweir     mpData = rSet.mpData;
1455*cdf0e10cSrcweir     mpData->mnRefCount++;
1456*cdf0e10cSrcweir }
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir // -----------------------------------------------------------------------
1459*cdf0e10cSrcweir 
1460*cdf0e10cSrcweir HelpSettings::~HelpSettings()
1461*cdf0e10cSrcweir {
1462*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
1463*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
1464*cdf0e10cSrcweir         delete mpData;
1465*cdf0e10cSrcweir     else
1466*cdf0e10cSrcweir         mpData->mnRefCount--;
1467*cdf0e10cSrcweir }
1468*cdf0e10cSrcweir 
1469*cdf0e10cSrcweir // -----------------------------------------------------------------------
1470*cdf0e10cSrcweir 
1471*cdf0e10cSrcweir const HelpSettings& HelpSettings::operator =( const HelpSettings& rSet )
1472*cdf0e10cSrcweir {
1473*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "HelpSettings: RefCount overflow" );
1474*cdf0e10cSrcweir 
1475*cdf0e10cSrcweir     // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
1476*cdf0e10cSrcweir     rSet.mpData->mnRefCount++;
1477*cdf0e10cSrcweir 
1478*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
1479*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
1480*cdf0e10cSrcweir         delete mpData;
1481*cdf0e10cSrcweir     else
1482*cdf0e10cSrcweir         mpData->mnRefCount--;
1483*cdf0e10cSrcweir 
1484*cdf0e10cSrcweir     mpData = rSet.mpData;
1485*cdf0e10cSrcweir 
1486*cdf0e10cSrcweir     return *this;
1487*cdf0e10cSrcweir }
1488*cdf0e10cSrcweir 
1489*cdf0e10cSrcweir // -----------------------------------------------------------------------
1490*cdf0e10cSrcweir 
1491*cdf0e10cSrcweir void HelpSettings::CopyData()
1492*cdf0e10cSrcweir {
1493*cdf0e10cSrcweir     // Falls noch andere Referenzen bestehen, dann kopieren
1494*cdf0e10cSrcweir     if ( mpData->mnRefCount != 1 )
1495*cdf0e10cSrcweir     {
1496*cdf0e10cSrcweir         mpData->mnRefCount--;
1497*cdf0e10cSrcweir         mpData = new ImplHelpData( *mpData );
1498*cdf0e10cSrcweir     }
1499*cdf0e10cSrcweir }
1500*cdf0e10cSrcweir 
1501*cdf0e10cSrcweir // -----------------------------------------------------------------------
1502*cdf0e10cSrcweir 
1503*cdf0e10cSrcweir sal_Bool HelpSettings::operator ==( const HelpSettings& rSet ) const
1504*cdf0e10cSrcweir {
1505*cdf0e10cSrcweir     if ( mpData == rSet.mpData )
1506*cdf0e10cSrcweir         return sal_True;
1507*cdf0e10cSrcweir 
1508*cdf0e10cSrcweir     if ( (mpData->mnOptions         == rSet.mpData->mnOptions ) &&
1509*cdf0e10cSrcweir          (mpData->mnTipDelay        == rSet.mpData->mnTipDelay ) &&
1510*cdf0e10cSrcweir          (mpData->mnTipTimeout      == rSet.mpData->mnTipTimeout ) &&
1511*cdf0e10cSrcweir          (mpData->mnBalloonDelay    == rSet.mpData->mnBalloonDelay ) )
1512*cdf0e10cSrcweir         return sal_True;
1513*cdf0e10cSrcweir     else
1514*cdf0e10cSrcweir         return sal_False;
1515*cdf0e10cSrcweir }
1516*cdf0e10cSrcweir 
1517*cdf0e10cSrcweir // =======================================================================
1518*cdf0e10cSrcweir 
1519*cdf0e10cSrcweir ImplAllSettingsData::ImplAllSettingsData()
1520*cdf0e10cSrcweir {
1521*cdf0e10cSrcweir     mnRefCount                  = 1;
1522*cdf0e10cSrcweir     mnSystemUpdate              = SETTINGS_ALLSETTINGS;
1523*cdf0e10cSrcweir     mnWindowUpdate              = SETTINGS_ALLSETTINGS;
1524*cdf0e10cSrcweir     meLanguage                  = LANGUAGE_SYSTEM;
1525*cdf0e10cSrcweir     meUILanguage                  = LANGUAGE_SYSTEM;
1526*cdf0e10cSrcweir     mpLocaleDataWrapper         = NULL;
1527*cdf0e10cSrcweir     mpUILocaleDataWrapper       = NULL;
1528*cdf0e10cSrcweir     mpCollatorWrapper           = NULL;
1529*cdf0e10cSrcweir     mpUICollatorWrapper         = NULL;
1530*cdf0e10cSrcweir     mpI18nHelper                = NULL;
1531*cdf0e10cSrcweir     mpUII18nHelper              = NULL;
1532*cdf0e10cSrcweir 	maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
1533*cdf0e10cSrcweir }
1534*cdf0e10cSrcweir 
1535*cdf0e10cSrcweir // -----------------------------------------------------------------------
1536*cdf0e10cSrcweir 
1537*cdf0e10cSrcweir ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
1538*cdf0e10cSrcweir     maMouseSettings( rData.maMouseSettings ),
1539*cdf0e10cSrcweir     maKeyboardSettings( rData.maKeyboardSettings ),
1540*cdf0e10cSrcweir     maStyleSettings( rData.maStyleSettings ),
1541*cdf0e10cSrcweir     maMiscSettings( rData.maMiscSettings ),
1542*cdf0e10cSrcweir     maNotificationSettings( rData.maNotificationSettings ),
1543*cdf0e10cSrcweir     maHelpSettings( rData.maHelpSettings ),
1544*cdf0e10cSrcweir     maLocale( rData.maLocale )
1545*cdf0e10cSrcweir {
1546*cdf0e10cSrcweir     mnRefCount                  = 1;
1547*cdf0e10cSrcweir     mnSystemUpdate              = rData.mnSystemUpdate;
1548*cdf0e10cSrcweir     mnWindowUpdate              = rData.mnWindowUpdate;
1549*cdf0e10cSrcweir     meLanguage                  = rData.meLanguage;
1550*cdf0e10cSrcweir     // Pointer couldn't shared and objects haven't a copy ctor
1551*cdf0e10cSrcweir     // So we create the cache objects new, if the GetFunction is
1552*cdf0e10cSrcweir     // called
1553*cdf0e10cSrcweir     mpLocaleDataWrapper         = NULL;
1554*cdf0e10cSrcweir     mpUILocaleDataWrapper       = NULL;
1555*cdf0e10cSrcweir     mpCollatorWrapper           = NULL;
1556*cdf0e10cSrcweir     mpUICollatorWrapper         = NULL;
1557*cdf0e10cSrcweir     mpI18nHelper                = NULL;
1558*cdf0e10cSrcweir     mpUII18nHelper              = NULL;
1559*cdf0e10cSrcweir }
1560*cdf0e10cSrcweir 
1561*cdf0e10cSrcweir // -----------------------------------------------------------------------
1562*cdf0e10cSrcweir 
1563*cdf0e10cSrcweir ImplAllSettingsData::~ImplAllSettingsData()
1564*cdf0e10cSrcweir {
1565*cdf0e10cSrcweir     if ( mpLocaleDataWrapper )
1566*cdf0e10cSrcweir         delete mpLocaleDataWrapper;
1567*cdf0e10cSrcweir     if ( mpUILocaleDataWrapper )
1568*cdf0e10cSrcweir         delete mpUILocaleDataWrapper;
1569*cdf0e10cSrcweir     if ( mpCollatorWrapper )
1570*cdf0e10cSrcweir         delete mpCollatorWrapper;
1571*cdf0e10cSrcweir     if ( mpUICollatorWrapper )
1572*cdf0e10cSrcweir         delete mpUICollatorWrapper;
1573*cdf0e10cSrcweir     if ( mpI18nHelper )
1574*cdf0e10cSrcweir         delete mpI18nHelper;
1575*cdf0e10cSrcweir     if ( mpUII18nHelper )
1576*cdf0e10cSrcweir         delete mpUII18nHelper;
1577*cdf0e10cSrcweir }
1578*cdf0e10cSrcweir 
1579*cdf0e10cSrcweir // -----------------------------------------------------------------------
1580*cdf0e10cSrcweir 
1581*cdf0e10cSrcweir AllSettings::AllSettings()
1582*cdf0e10cSrcweir {
1583*cdf0e10cSrcweir     DBG_CTOR( AllSettings, NULL );
1584*cdf0e10cSrcweir 
1585*cdf0e10cSrcweir     mpData = new ImplAllSettingsData();
1586*cdf0e10cSrcweir }
1587*cdf0e10cSrcweir 
1588*cdf0e10cSrcweir // -----------------------------------------------------------------------
1589*cdf0e10cSrcweir 
1590*cdf0e10cSrcweir AllSettings::AllSettings( const AllSettings& rSet )
1591*cdf0e10cSrcweir {
1592*cdf0e10cSrcweir     DBG_CTOR( AllSettings, NULL );
1593*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "Settings: RefCount overflow" );
1594*cdf0e10cSrcweir 
1595*cdf0e10cSrcweir     // shared Instance Daten uebernehmen und Referenzcounter erhoehen
1596*cdf0e10cSrcweir     mpData = rSet.mpData;
1597*cdf0e10cSrcweir     mpData->mnRefCount++;
1598*cdf0e10cSrcweir }
1599*cdf0e10cSrcweir 
1600*cdf0e10cSrcweir // -----------------------------------------------------------------------
1601*cdf0e10cSrcweir 
1602*cdf0e10cSrcweir AllSettings::~AllSettings()
1603*cdf0e10cSrcweir {
1604*cdf0e10cSrcweir     DBG_DTOR( AllSettings, NULL );
1605*cdf0e10cSrcweir 
1606*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
1607*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
1608*cdf0e10cSrcweir         delete mpData;
1609*cdf0e10cSrcweir     else
1610*cdf0e10cSrcweir         mpData->mnRefCount--;
1611*cdf0e10cSrcweir }
1612*cdf0e10cSrcweir 
1613*cdf0e10cSrcweir // -----------------------------------------------------------------------
1614*cdf0e10cSrcweir 
1615*cdf0e10cSrcweir const AllSettings& AllSettings::operator =( const AllSettings& rSet )
1616*cdf0e10cSrcweir {
1617*cdf0e10cSrcweir     DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "AllSettings: RefCount overflow" );
1618*cdf0e10cSrcweir     DBG_CHKTHIS( AllSettings, NULL );
1619*cdf0e10cSrcweir     DBG_CHKOBJ( &rSet, AllSettings, NULL );
1620*cdf0e10cSrcweir 
1621*cdf0e10cSrcweir     // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
1622*cdf0e10cSrcweir     rSet.mpData->mnRefCount++;
1623*cdf0e10cSrcweir 
1624*cdf0e10cSrcweir     // Daten loeschen, wenn letzte Referenz
1625*cdf0e10cSrcweir     if ( mpData->mnRefCount == 1 )
1626*cdf0e10cSrcweir         delete mpData;
1627*cdf0e10cSrcweir     else
1628*cdf0e10cSrcweir         mpData->mnRefCount--;
1629*cdf0e10cSrcweir 
1630*cdf0e10cSrcweir     mpData = rSet.mpData;
1631*cdf0e10cSrcweir 
1632*cdf0e10cSrcweir     return *this;
1633*cdf0e10cSrcweir }
1634*cdf0e10cSrcweir 
1635*cdf0e10cSrcweir // -----------------------------------------------------------------------
1636*cdf0e10cSrcweir 
1637*cdf0e10cSrcweir void AllSettings::CopyData()
1638*cdf0e10cSrcweir {
1639*cdf0e10cSrcweir     DBG_CHKTHIS( AllSettings, NULL );
1640*cdf0e10cSrcweir 
1641*cdf0e10cSrcweir     // Falls noch andere Referenzen bestehen, dann kopieren
1642*cdf0e10cSrcweir     if ( mpData->mnRefCount != 1 )
1643*cdf0e10cSrcweir     {
1644*cdf0e10cSrcweir         mpData->mnRefCount--;
1645*cdf0e10cSrcweir         mpData = new ImplAllSettingsData( *mpData );
1646*cdf0e10cSrcweir     }
1647*cdf0e10cSrcweir }
1648*cdf0e10cSrcweir 
1649*cdf0e10cSrcweir // -----------------------------------------------------------------------
1650*cdf0e10cSrcweir 
1651*cdf0e10cSrcweir sal_uLong AllSettings::Update( sal_uLong nFlags, const AllSettings& rSet )
1652*cdf0e10cSrcweir {
1653*cdf0e10cSrcweir     DBG_CHKTHIS( AllSettings, NULL );
1654*cdf0e10cSrcweir     DBG_CHKOBJ( &rSet, AllSettings, NULL );
1655*cdf0e10cSrcweir 
1656*cdf0e10cSrcweir     sal_uLong nChangeFlags = 0;
1657*cdf0e10cSrcweir 
1658*cdf0e10cSrcweir     if ( nFlags & SETTINGS_MACHINE )
1659*cdf0e10cSrcweir     {
1660*cdf0e10cSrcweir         if ( mpData->maMachineSettings != rSet.mpData->maMachineSettings )
1661*cdf0e10cSrcweir         {
1662*cdf0e10cSrcweir             CopyData();
1663*cdf0e10cSrcweir             mpData->maMachineSettings = rSet.mpData->maMachineSettings;
1664*cdf0e10cSrcweir             nChangeFlags |= SETTINGS_MACHINE;
1665*cdf0e10cSrcweir         }
1666*cdf0e10cSrcweir     }
1667*cdf0e10cSrcweir 
1668*cdf0e10cSrcweir     if ( nFlags & SETTINGS_MOUSE )
1669*cdf0e10cSrcweir     {
1670*cdf0e10cSrcweir         if ( mpData->maMouseSettings != rSet.mpData->maMouseSettings )
1671*cdf0e10cSrcweir         {
1672*cdf0e10cSrcweir             CopyData();
1673*cdf0e10cSrcweir             mpData->maMouseSettings = rSet.mpData->maMouseSettings;
1674*cdf0e10cSrcweir             nChangeFlags |= SETTINGS_MOUSE;
1675*cdf0e10cSrcweir         }
1676*cdf0e10cSrcweir     }
1677*cdf0e10cSrcweir 
1678*cdf0e10cSrcweir     if ( nFlags & SETTINGS_KEYBOARD )
1679*cdf0e10cSrcweir     {
1680*cdf0e10cSrcweir         if ( mpData->maKeyboardSettings != rSet.mpData->maKeyboardSettings )
1681*cdf0e10cSrcweir         {
1682*cdf0e10cSrcweir             CopyData();
1683*cdf0e10cSrcweir             mpData->maKeyboardSettings = rSet.mpData->maKeyboardSettings;
1684*cdf0e10cSrcweir             nChangeFlags |= SETTINGS_KEYBOARD;
1685*cdf0e10cSrcweir         }
1686*cdf0e10cSrcweir     }
1687*cdf0e10cSrcweir 
1688*cdf0e10cSrcweir     if ( nFlags & SETTINGS_STYLE )
1689*cdf0e10cSrcweir     {
1690*cdf0e10cSrcweir         if ( mpData->maStyleSettings != rSet.mpData->maStyleSettings )
1691*cdf0e10cSrcweir         {
1692*cdf0e10cSrcweir             CopyData();
1693*cdf0e10cSrcweir             mpData->maStyleSettings = rSet.mpData->maStyleSettings;
1694*cdf0e10cSrcweir             nChangeFlags |= SETTINGS_STYLE;
1695*cdf0e10cSrcweir         }
1696*cdf0e10cSrcweir     }
1697*cdf0e10cSrcweir 
1698*cdf0e10cSrcweir     if ( nFlags & SETTINGS_MISC )
1699*cdf0e10cSrcweir     {
1700*cdf0e10cSrcweir         if ( mpData->maMiscSettings != rSet.mpData->maMiscSettings )
1701*cdf0e10cSrcweir         {
1702*cdf0e10cSrcweir             CopyData();
1703*cdf0e10cSrcweir             mpData->maMiscSettings = rSet.mpData->maMiscSettings;
1704*cdf0e10cSrcweir             nChangeFlags |= SETTINGS_MISC;
1705*cdf0e10cSrcweir         }
1706*cdf0e10cSrcweir     }
1707*cdf0e10cSrcweir 
1708*cdf0e10cSrcweir     if ( nFlags & SETTINGS_NOTIFICATION )
1709*cdf0e10cSrcweir     {
1710*cdf0e10cSrcweir         if ( mpData->maNotificationSettings != rSet.mpData->maNotificationSettings )
1711*cdf0e10cSrcweir         {
1712*cdf0e10cSrcweir             CopyData();
1713*cdf0e10cSrcweir             mpData->maNotificationSettings = rSet.mpData->maNotificationSettings;
1714*cdf0e10cSrcweir             nChangeFlags |= SETTINGS_NOTIFICATION;
1715*cdf0e10cSrcweir         }
1716*cdf0e10cSrcweir     }
1717*cdf0e10cSrcweir 
1718*cdf0e10cSrcweir     if ( nFlags & SETTINGS_HELP )
1719*cdf0e10cSrcweir     {
1720*cdf0e10cSrcweir         if ( mpData->maHelpSettings != rSet.mpData->maHelpSettings )
1721*cdf0e10cSrcweir         {
1722*cdf0e10cSrcweir             CopyData();
1723*cdf0e10cSrcweir             mpData->maHelpSettings = rSet.mpData->maHelpSettings;
1724*cdf0e10cSrcweir             nChangeFlags |= SETTINGS_HELP;
1725*cdf0e10cSrcweir         }
1726*cdf0e10cSrcweir     }
1727*cdf0e10cSrcweir 
1728*cdf0e10cSrcweir     if ( nFlags & SETTINGS_INTERNATIONAL )
1729*cdf0e10cSrcweir     {
1730*cdf0e10cSrcweir         // Nothing, class International is gone.
1731*cdf0e10cSrcweir         DBG_ERRORFILE("AllSettings::Update: who calls with SETTINGS_INTERNATIONAL and why? You're flogging a dead horse.");
1732*cdf0e10cSrcweir     }
1733*cdf0e10cSrcweir 
1734*cdf0e10cSrcweir     if ( nFlags & SETTINGS_LOCALE )
1735*cdf0e10cSrcweir     {
1736*cdf0e10cSrcweir         if ( mpData->meLanguage || rSet.mpData->meLanguage )
1737*cdf0e10cSrcweir         {
1738*cdf0e10cSrcweir             SetLanguage( rSet.mpData->meLanguage );
1739*cdf0e10cSrcweir             nChangeFlags |= SETTINGS_LOCALE;
1740*cdf0e10cSrcweir         }
1741*cdf0e10cSrcweir     }
1742*cdf0e10cSrcweir 
1743*cdf0e10cSrcweir     if ( nFlags & SETTINGS_UILOCALE )
1744*cdf0e10cSrcweir     {
1745*cdf0e10cSrcweir 		// UILocale can't be changed
1746*cdf0e10cSrcweir     }
1747*cdf0e10cSrcweir 
1748*cdf0e10cSrcweir     return nChangeFlags;
1749*cdf0e10cSrcweir }
1750*cdf0e10cSrcweir 
1751*cdf0e10cSrcweir // -----------------------------------------------------------------------
1752*cdf0e10cSrcweir 
1753*cdf0e10cSrcweir sal_uLong AllSettings::GetChangeFlags( const AllSettings& rSet ) const
1754*cdf0e10cSrcweir {
1755*cdf0e10cSrcweir     DBG_CHKTHIS( AllSettings, NULL );
1756*cdf0e10cSrcweir     DBG_CHKOBJ( &rSet, AllSettings, NULL );
1757*cdf0e10cSrcweir 
1758*cdf0e10cSrcweir     sal_uLong nChangeFlags = 0;
1759*cdf0e10cSrcweir 
1760*cdf0e10cSrcweir     if ( mpData->maMachineSettings != rSet.mpData->maMachineSettings )
1761*cdf0e10cSrcweir         nChangeFlags |= SETTINGS_MACHINE;
1762*cdf0e10cSrcweir 
1763*cdf0e10cSrcweir     if ( mpData->maMouseSettings != rSet.mpData->maMouseSettings )
1764*cdf0e10cSrcweir         nChangeFlags |= SETTINGS_MOUSE;
1765*cdf0e10cSrcweir 
1766*cdf0e10cSrcweir     if ( mpData->maKeyboardSettings != rSet.mpData->maKeyboardSettings )
1767*cdf0e10cSrcweir         nChangeFlags |= SETTINGS_KEYBOARD;
1768*cdf0e10cSrcweir 
1769*cdf0e10cSrcweir     if ( mpData->maStyleSettings != rSet.mpData->maStyleSettings )
1770*cdf0e10cSrcweir         nChangeFlags |= SETTINGS_STYLE;
1771*cdf0e10cSrcweir 
1772*cdf0e10cSrcweir     if ( mpData->maMiscSettings != rSet.mpData->maMiscSettings )
1773*cdf0e10cSrcweir         nChangeFlags |= SETTINGS_MISC;
1774*cdf0e10cSrcweir 
1775*cdf0e10cSrcweir     if ( mpData->maNotificationSettings != rSet.mpData->maNotificationSettings )
1776*cdf0e10cSrcweir         nChangeFlags |= SETTINGS_NOTIFICATION;
1777*cdf0e10cSrcweir 
1778*cdf0e10cSrcweir     if ( mpData->maHelpSettings != rSet.mpData->maHelpSettings )
1779*cdf0e10cSrcweir         nChangeFlags |= SETTINGS_HELP;
1780*cdf0e10cSrcweir 
1781*cdf0e10cSrcweir     if ( mpData->meLanguage || rSet.mpData->meLanguage )
1782*cdf0e10cSrcweir         nChangeFlags |= SETTINGS_LOCALE;
1783*cdf0e10cSrcweir 
1784*cdf0e10cSrcweir     return nChangeFlags;
1785*cdf0e10cSrcweir }
1786*cdf0e10cSrcweir 
1787*cdf0e10cSrcweir // -----------------------------------------------------------------------
1788*cdf0e10cSrcweir 
1789*cdf0e10cSrcweir sal_Bool AllSettings::operator ==( const AllSettings& rSet ) const
1790*cdf0e10cSrcweir {
1791*cdf0e10cSrcweir     DBG_CHKTHIS( AllSettings, NULL );
1792*cdf0e10cSrcweir     DBG_CHKOBJ( &rSet, AllSettings, NULL );
1793*cdf0e10cSrcweir 
1794*cdf0e10cSrcweir     if ( mpData == rSet.mpData )
1795*cdf0e10cSrcweir         return sal_True;
1796*cdf0e10cSrcweir 
1797*cdf0e10cSrcweir     if ( (mpData->maMachineSettings         == rSet.mpData->maMachineSettings)      &&
1798*cdf0e10cSrcweir          (mpData->maMouseSettings           == rSet.mpData->maMouseSettings)        &&
1799*cdf0e10cSrcweir          (mpData->maKeyboardSettings        == rSet.mpData->maKeyboardSettings)     &&
1800*cdf0e10cSrcweir          (mpData->maStyleSettings           == rSet.mpData->maStyleSettings)        &&
1801*cdf0e10cSrcweir          (mpData->maMiscSettings            == rSet.mpData->maMiscSettings)         &&
1802*cdf0e10cSrcweir          (mpData->maNotificationSettings    == rSet.mpData->maNotificationSettings) &&
1803*cdf0e10cSrcweir          (mpData->maHelpSettings            == rSet.mpData->maHelpSettings)         &&
1804*cdf0e10cSrcweir          (mpData->mnSystemUpdate            == rSet.mpData->mnSystemUpdate)         &&
1805*cdf0e10cSrcweir          (mpData->maLocale					== rSet.mpData->maLocale)				&&
1806*cdf0e10cSrcweir          (mpData->mnWindowUpdate            == rSet.mpData->mnWindowUpdate) )
1807*cdf0e10cSrcweir     {
1808*cdf0e10cSrcweir         return sal_True;
1809*cdf0e10cSrcweir     }
1810*cdf0e10cSrcweir 	else
1811*cdf0e10cSrcweir 		return sal_False;
1812*cdf0e10cSrcweir }
1813*cdf0e10cSrcweir 
1814*cdf0e10cSrcweir // -----------------------------------------------------------------------
1815*cdf0e10cSrcweir 
1816*cdf0e10cSrcweir void AllSettings::SetLocale( const ::com::sun::star::lang::Locale& rLocale )
1817*cdf0e10cSrcweir {
1818*cdf0e10cSrcweir 	CopyData();
1819*cdf0e10cSrcweir 
1820*cdf0e10cSrcweir 	mpData->maLocale = rLocale;
1821*cdf0e10cSrcweir 
1822*cdf0e10cSrcweir 	if ( !rLocale.Language.getLength() )
1823*cdf0e10cSrcweir 		mpData->meLanguage = LANGUAGE_SYSTEM;
1824*cdf0e10cSrcweir 	else
1825*cdf0e10cSrcweir 		mpData->meLanguage = MsLangId::convertLocaleToLanguage( rLocale );
1826*cdf0e10cSrcweir 	if ( mpData->mpLocaleDataWrapper )
1827*cdf0e10cSrcweir 	{
1828*cdf0e10cSrcweir 		delete mpData->mpLocaleDataWrapper;
1829*cdf0e10cSrcweir 		mpData->mpLocaleDataWrapper = NULL;
1830*cdf0e10cSrcweir 	}
1831*cdf0e10cSrcweir 	if ( mpData->mpI18nHelper )
1832*cdf0e10cSrcweir 	{
1833*cdf0e10cSrcweir 		delete mpData->mpI18nHelper;
1834*cdf0e10cSrcweir 		mpData->mpI18nHelper = NULL;
1835*cdf0e10cSrcweir 	}
1836*cdf0e10cSrcweir }
1837*cdf0e10cSrcweir 
1838*cdf0e10cSrcweir // -----------------------------------------------------------------------
1839*cdf0e10cSrcweir 
1840*cdf0e10cSrcweir void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& )
1841*cdf0e10cSrcweir {
1842*cdf0e10cSrcweir 	// there is only one UILocale per process
1843*cdf0e10cSrcweir }
1844*cdf0e10cSrcweir 
1845*cdf0e10cSrcweir // -----------------------------------------------------------------------
1846*cdf0e10cSrcweir 
1847*cdf0e10cSrcweir void AllSettings::SetLanguage( LanguageType eLang )
1848*cdf0e10cSrcweir {
1849*cdf0e10cSrcweir 	if ( eLang != mpData->meLanguage )
1850*cdf0e10cSrcweir 	{
1851*cdf0e10cSrcweir 		CopyData();
1852*cdf0e10cSrcweir 
1853*cdf0e10cSrcweir 		mpData->meLanguage = eLang;
1854*cdf0e10cSrcweir 		MsLangId::convertLanguageToLocale( GetLanguage(), ((AllSettings*)this)->mpData->maLocale );
1855*cdf0e10cSrcweir 		if ( mpData->mpLocaleDataWrapper )
1856*cdf0e10cSrcweir 		{
1857*cdf0e10cSrcweir 			delete mpData->mpLocaleDataWrapper;
1858*cdf0e10cSrcweir 			mpData->mpLocaleDataWrapper = NULL;
1859*cdf0e10cSrcweir 		}
1860*cdf0e10cSrcweir 		if ( mpData->mpI18nHelper )
1861*cdf0e10cSrcweir 		{
1862*cdf0e10cSrcweir 			delete mpData->mpI18nHelper;
1863*cdf0e10cSrcweir 			mpData->mpI18nHelper = NULL;
1864*cdf0e10cSrcweir 		}
1865*cdf0e10cSrcweir 	}
1866*cdf0e10cSrcweir }
1867*cdf0e10cSrcweir 
1868*cdf0e10cSrcweir // -----------------------------------------------------------------------
1869*cdf0e10cSrcweir 
1870*cdf0e10cSrcweir void AllSettings::SetUILanguage( LanguageType  )
1871*cdf0e10cSrcweir {
1872*cdf0e10cSrcweir 	// there is only one UILanguage per process
1873*cdf0e10cSrcweir }
1874*cdf0e10cSrcweir 
1875*cdf0e10cSrcweir // -----------------------------------------------------------------------
1876*cdf0e10cSrcweir 
1877*cdf0e10cSrcweir sal_Bool AllSettings::GetLayoutRTL() const
1878*cdf0e10cSrcweir {
1879*cdf0e10cSrcweir     static const char* pEnv = getenv("SAL_RTL_ENABLED" );
1880*cdf0e10cSrcweir     static int  nUIMirroring = -1;   // -1: undef, 0: auto, 1: on 2: off
1881*cdf0e10cSrcweir 
1882*cdf0e10cSrcweir     // environment always overrides
1883*cdf0e10cSrcweir     if( pEnv )
1884*cdf0e10cSrcweir         return true;
1885*cdf0e10cSrcweir 
1886*cdf0e10cSrcweir     sal_Bool bRTL = sal_False;
1887*cdf0e10cSrcweir 
1888*cdf0e10cSrcweir     if( nUIMirroring == -1 )
1889*cdf0e10cSrcweir     {
1890*cdf0e10cSrcweir         nUIMirroring = 0; // ask configuration only once
1891*cdf0e10cSrcweir         utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
1892*cdf0e10cSrcweir             vcl::unohelper::GetMultiServiceFactory(),
1893*cdf0e10cSrcweir             OUString::createFromAscii( "org.openoffice.Office.Common/I18N/CTL" ) );    // note: case sensisitive !
1894*cdf0e10cSrcweir         if ( aNode.isValid() )
1895*cdf0e10cSrcweir         {
1896*cdf0e10cSrcweir             sal_Bool bTmp = sal_Bool();
1897*cdf0e10cSrcweir             ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString::createFromAscii( "UIMirroring" ) );
1898*cdf0e10cSrcweir             if( aValue >>= bTmp )
1899*cdf0e10cSrcweir             {
1900*cdf0e10cSrcweir                 // found true or false; if it was nil, nothing is changed
1901*cdf0e10cSrcweir                 nUIMirroring = bTmp ? 1 : 2;
1902*cdf0e10cSrcweir             }
1903*cdf0e10cSrcweir         }
1904*cdf0e10cSrcweir     }
1905*cdf0e10cSrcweir 
1906*cdf0e10cSrcweir     if( nUIMirroring == 0 )  // no config found (eg, setup) or default (nil) was set: check language
1907*cdf0e10cSrcweir     {
1908*cdf0e10cSrcweir         LanguageType aLang = LANGUAGE_DONTKNOW;
1909*cdf0e10cSrcweir         ImplSVData* pSVData = ImplGetSVData();
1910*cdf0e10cSrcweir         if ( pSVData->maAppData.mpSettings )
1911*cdf0e10cSrcweir             aLang = pSVData->maAppData.mpSettings->GetUILanguage();
1912*cdf0e10cSrcweir         bRTL = MsLangId::isRightToLeft( aLang );
1913*cdf0e10cSrcweir     }
1914*cdf0e10cSrcweir     else
1915*cdf0e10cSrcweir         bRTL = (nUIMirroring == 1);
1916*cdf0e10cSrcweir 
1917*cdf0e10cSrcweir     return bRTL;
1918*cdf0e10cSrcweir }
1919*cdf0e10cSrcweir 
1920*cdf0e10cSrcweir // -----------------------------------------------------------------------
1921*cdf0e10cSrcweir 
1922*cdf0e10cSrcweir const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const
1923*cdf0e10cSrcweir {
1924*cdf0e10cSrcweir     if ( !mpData->maLocale.Language.getLength() )
1925*cdf0e10cSrcweir 		mpData->maLocale = mpData->maSysLocale.GetLocale();
1926*cdf0e10cSrcweir 
1927*cdf0e10cSrcweir     return mpData->maLocale;
1928*cdf0e10cSrcweir }
1929*cdf0e10cSrcweir 
1930*cdf0e10cSrcweir // -----------------------------------------------------------------------
1931*cdf0e10cSrcweir 
1932*cdf0e10cSrcweir const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const
1933*cdf0e10cSrcweir {
1934*cdf0e10cSrcweir 	// the UILocale is never changed
1935*cdf0e10cSrcweir     if ( !mpData->maUILocale.Language.getLength() )
1936*cdf0e10cSrcweir 		mpData->maUILocale = mpData->maSysLocale.GetUILocale();
1937*cdf0e10cSrcweir 
1938*cdf0e10cSrcweir     return mpData->maUILocale;
1939*cdf0e10cSrcweir }
1940*cdf0e10cSrcweir 
1941*cdf0e10cSrcweir // -----------------------------------------------------------------------
1942*cdf0e10cSrcweir 
1943*cdf0e10cSrcweir LanguageType AllSettings::GetLanguage() const
1944*cdf0e10cSrcweir {
1945*cdf0e10cSrcweir 	// meLanguage == LANGUAGE_SYSTEM means: use settings from SvtSysLocale
1946*cdf0e10cSrcweir     if ( mpData->meLanguage == LANGUAGE_SYSTEM )
1947*cdf0e10cSrcweir         return mpData->maSysLocale.GetLanguage();
1948*cdf0e10cSrcweir 
1949*cdf0e10cSrcweir     return mpData->meLanguage;
1950*cdf0e10cSrcweir }
1951*cdf0e10cSrcweir 
1952*cdf0e10cSrcweir // -----------------------------------------------------------------------
1953*cdf0e10cSrcweir 
1954*cdf0e10cSrcweir LanguageType AllSettings::GetUILanguage() const
1955*cdf0e10cSrcweir {
1956*cdf0e10cSrcweir 	// the UILanguage is never changed
1957*cdf0e10cSrcweir 	return mpData->maSysLocale.GetUILanguage();
1958*cdf0e10cSrcweir }
1959*cdf0e10cSrcweir 
1960*cdf0e10cSrcweir // -----------------------------------------------------------------------
1961*cdf0e10cSrcweir 
1962*cdf0e10cSrcweir const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const
1963*cdf0e10cSrcweir {
1964*cdf0e10cSrcweir     if ( !mpData->mpLocaleDataWrapper )
1965*cdf0e10cSrcweir         ((AllSettings*)this)->mpData->mpLocaleDataWrapper = new LocaleDataWrapper( vcl::unohelper::GetMultiServiceFactory(), GetLocale() );
1966*cdf0e10cSrcweir     return *mpData->mpLocaleDataWrapper;
1967*cdf0e10cSrcweir }
1968*cdf0e10cSrcweir 
1969*cdf0e10cSrcweir // -----------------------------------------------------------------------
1970*cdf0e10cSrcweir 
1971*cdf0e10cSrcweir const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const
1972*cdf0e10cSrcweir {
1973*cdf0e10cSrcweir     if ( !mpData->mpUILocaleDataWrapper )
1974*cdf0e10cSrcweir         ((AllSettings*)this)->mpData->mpUILocaleDataWrapper = new LocaleDataWrapper( vcl::unohelper::GetMultiServiceFactory(), GetUILocale() );
1975*cdf0e10cSrcweir     return *mpData->mpUILocaleDataWrapper;
1976*cdf0e10cSrcweir }
1977*cdf0e10cSrcweir 
1978*cdf0e10cSrcweir // -----------------------------------------------------------------------
1979*cdf0e10cSrcweir 
1980*cdf0e10cSrcweir const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
1981*cdf0e10cSrcweir {
1982*cdf0e10cSrcweir     if ( !mpData->mpI18nHelper ) {
1983*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> aFactory(vcl::unohelper::GetMultiServiceFactory());
1984*cdf0e10cSrcweir         ((AllSettings*)this)->mpData->mpI18nHelper = new vcl::I18nHelper( aFactory, GetLocale() );
1985*cdf0e10cSrcweir     }
1986*cdf0e10cSrcweir     return *mpData->mpI18nHelper;
1987*cdf0e10cSrcweir }
1988*cdf0e10cSrcweir 
1989*cdf0e10cSrcweir // -----------------------------------------------------------------------
1990*cdf0e10cSrcweir 
1991*cdf0e10cSrcweir const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
1992*cdf0e10cSrcweir {
1993*cdf0e10cSrcweir     if ( !mpData->mpUII18nHelper ) {
1994*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> aFactory(vcl::unohelper::GetMultiServiceFactory());
1995*cdf0e10cSrcweir         ((AllSettings*)this)->mpData->mpUII18nHelper = new vcl::I18nHelper( aFactory, GetUILocale() );
1996*cdf0e10cSrcweir     }
1997*cdf0e10cSrcweir     return *mpData->mpUII18nHelper;
1998*cdf0e10cSrcweir }
1999*cdf0e10cSrcweir 
2000*cdf0e10cSrcweir 
2001*cdf0e10cSrcweir // -----------------------------------------------------------------------
2002*cdf0e10cSrcweir /*
2003*cdf0e10cSrcweir const CollatorWrapper& AllSettings::GetCollatorWrapper() const
2004*cdf0e10cSrcweir {
2005*cdf0e10cSrcweir     if ( !mpData->mpCollatorWrapper )
2006*cdf0e10cSrcweir     {
2007*cdf0e10cSrcweir         ((AllSettings*)this)->mpData->mpCollatorWrapper = new CollatorWrapper( vcl::unohelper::GetMultiServiceFactory() );
2008*cdf0e10cSrcweir         ((AllSettings*)this)->mpData->mpCollatorWrapper->loadDefaultCollator( GetLocale(), 0 );
2009*cdf0e10cSrcweir     }
2010*cdf0e10cSrcweir     return *mpData->mpCollatorWrapper;
2011*cdf0e10cSrcweir }
2012*cdf0e10cSrcweir */
2013*cdf0e10cSrcweir // -----------------------------------------------------------------------
2014*cdf0e10cSrcweir /*
2015*cdf0e10cSrcweir const CollatorWrapper& AllSettings::GetUICollatorWrapper() const
2016*cdf0e10cSrcweir {
2017*cdf0e10cSrcweir     if ( !mpData->mpUICollatorWrapper )
2018*cdf0e10cSrcweir     {
2019*cdf0e10cSrcweir         ((AllSettings*)this)->mpData->mpUICollatorWrapper = new CollatorWrapper( vcl::unohelper::GetMultiServiceFactory() );
2020*cdf0e10cSrcweir         ((AllSettings*)this)->mpData->mpUICollatorWrapper->loadDefaultCollator( GetUILocale(), 0 );
2021*cdf0e10cSrcweir     }
2022*cdf0e10cSrcweir     return *mpData->mpUICollatorWrapper;
2023*cdf0e10cSrcweir }
2024*cdf0e10cSrcweir */
2025*cdf0e10cSrcweir 
2026*cdf0e10cSrcweir void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint )
2027*cdf0e10cSrcweir {
2028*cdf0e10cSrcweir 	AllSettings aAllSettings( Application::GetSettings() );
2029*cdf0e10cSrcweir 	if ( nHint & SYSLOCALEOPTIONS_HINT_DECSEP )
2030*cdf0e10cSrcweir 	{
2031*cdf0e10cSrcweir 		MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
2032*cdf0e10cSrcweir 		sal_Bool bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale();
2033*cdf0e10cSrcweir 		if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale )
2034*cdf0e10cSrcweir 		{
2035*cdf0e10cSrcweir 			aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale );
2036*cdf0e10cSrcweir 			aAllSettings.SetMiscSettings( aMiscSettings );
2037*cdf0e10cSrcweir 		}
2038*cdf0e10cSrcweir 	}
2039*cdf0e10cSrcweir 
2040*cdf0e10cSrcweir 	if ( (nHint & SYSLOCALEOPTIONS_HINT_LOCALE) )
2041*cdf0e10cSrcweir 		aAllSettings.SetLocale( aAllSettings.mpData->maSysLocale.GetOptions().GetLocale() );
2042*cdf0e10cSrcweir 
2043*cdf0e10cSrcweir 	Application::SetSettings( aAllSettings );
2044*cdf0e10cSrcweir }
2045