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