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