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