Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <svsys.h>
30 : : #include "tools/debug.hxx"
31 : :
32 : : #include "i18npool/mslangid.hxx"
33 : :
34 : : #include "vcl/svapp.hxx"
35 : : #include "vcl/event.hxx"
36 : : #include "vcl/settings.hxx"
37 : : #include "vcl/i18nhelp.hxx"
38 : : #include "vcl/configsettings.hxx"
39 : : #include "vcl/gradient.hxx"
40 : : #include "vcl/unohelp.hxx"
41 : : #include "vcl/bitmapex.hxx"
42 : :
43 : : #include "unotools/fontcfg.hxx"
44 : : #include "unotools/localedatawrapper.hxx"
45 : : #include "unotools/collatorwrapper.hxx"
46 : : #include "unotools/confignode.hxx"
47 : : #include "unotools/syslocaleoptions.hxx"
48 : :
49 : : using ::rtl::OUString;
50 : :
51 : : #include "svdata.hxx"
52 : : #include "impimagetree.hxx"
53 : : // =======================================================================
54 : :
55 : : DBG_NAME( AllSettings )
56 : :
57 : : // =======================================================================
58 : :
59 : 251 : ImplMouseData::ImplMouseData()
60 : : {
61 : 251 : mnRefCount = 1;
62 : 251 : mnOptions = 0;
63 : 251 : mnDoubleClkTime = 500;
64 : 251 : mnDoubleClkWidth = 2;
65 : 251 : mnDoubleClkHeight = 2;
66 : 251 : mnStartDragWidth = 2;
67 : 251 : mnStartDragHeight = 2;
68 : 251 : mnStartDragCode = MOUSE_LEFT;
69 : 251 : mnDragMoveCode = 0;
70 : 251 : mnDragCopyCode = KEY_MOD1;
71 : 251 : mnDragLinkCode = KEY_SHIFT | KEY_MOD1;
72 : 251 : mnContextMenuCode = MOUSE_RIGHT;
73 : 251 : mnContextMenuClicks = 1;
74 : 251 : mbContextMenuDown = sal_True;
75 : 251 : mnMiddleButtonAction = MOUSE_MIDDLE_AUTOSCROLL;
76 : 251 : mnScrollRepeat = 100;
77 : 251 : mnButtonStartRepeat = 370;
78 : 251 : mnButtonRepeat = 90;
79 : 251 : mnActionDelay = 250;
80 : 251 : mnMenuDelay = 150;
81 : 251 : mnFollow = MOUSE_FOLLOW_MENU | MOUSE_FOLLOW_DDLIST;
82 : 251 : mnWheelBehavior = MOUSE_WHEEL_ALWAYS;
83 : 251 : }
84 : :
85 : : // -----------------------------------------------------------------------
86 : :
87 : 2176 : ImplMouseData::ImplMouseData( const ImplMouseData& rData )
88 : : {
89 : 2176 : mnRefCount = 1;
90 : 2176 : mnOptions = rData.mnOptions;
91 : 2176 : mnDoubleClkTime = rData.mnDoubleClkTime;
92 : 2176 : mnDoubleClkWidth = rData.mnDoubleClkWidth;
93 : 2176 : mnDoubleClkHeight = rData.mnDoubleClkHeight;
94 : 2176 : mnStartDragWidth = rData.mnStartDragWidth;
95 : 2176 : mnStartDragHeight = rData.mnStartDragHeight;
96 : 2176 : mnStartDragCode = rData.mnStartDragCode;
97 : 2176 : mnDragMoveCode = rData.mnDragMoveCode;
98 : 2176 : mnDragCopyCode = rData.mnDragCopyCode;
99 : 2176 : mnDragLinkCode = rData.mnDragLinkCode;
100 : 2176 : mnContextMenuCode = rData.mnContextMenuCode;
101 : 2176 : mnContextMenuClicks = rData.mnContextMenuClicks;
102 : 2176 : mbContextMenuDown = rData.mbContextMenuDown;
103 : 2176 : mnMiddleButtonAction = rData.mnMiddleButtonAction;
104 : 2176 : mnScrollRepeat = rData.mnScrollRepeat;
105 : 2176 : mnButtonStartRepeat = rData.mnButtonStartRepeat;
106 : 2176 : mnButtonRepeat = rData.mnButtonRepeat;
107 : 2176 : mnActionDelay = rData.mnActionDelay;
108 : 2176 : mnMenuDelay = rData.mnMenuDelay;
109 : 2176 : mnFollow = rData.mnFollow;
110 : 2176 : mnWheelBehavior = rData.mnWheelBehavior;
111 : 2176 : }
112 : :
113 : : // -----------------------------------------------------------------------
114 : :
115 : 251 : MouseSettings::MouseSettings()
116 : : {
117 : 251 : mpData = new ImplMouseData();
118 : 251 : }
119 : :
120 : : // -----------------------------------------------------------------------
121 : :
122 : 40916 : MouseSettings::MouseSettings( const MouseSettings& rSet )
123 : : {
124 : : DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "MouseSettings: RefCount overflow" );
125 : :
126 : : // copy shared instance data and increment reference counter
127 : 40916 : mpData = rSet.mpData;
128 : 40916 : mpData->mnRefCount++;
129 : 40916 : }
130 : :
131 : : // -----------------------------------------------------------------------
132 : :
133 : 40926 : MouseSettings::~MouseSettings()
134 : : {
135 : : // delete data if last reference
136 [ + + ]: 40926 : if ( mpData->mnRefCount == 1 )
137 : 2324 : delete mpData;
138 : : else
139 : 38602 : mpData->mnRefCount--;
140 : 40926 : }
141 : :
142 : : // -----------------------------------------------------------------------
143 : :
144 : 2508 : const MouseSettings& MouseSettings::operator =( const MouseSettings& rSet )
145 : : {
146 : : DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "MouseSettings: RefCount overflow" );
147 : :
148 : : // increment reference counter first, to be able to assign oneself
149 : 2508 : rSet.mpData->mnRefCount++;
150 : :
151 : : // delete data if last reference
152 [ - + ]: 2508 : if ( mpData->mnRefCount == 1 )
153 : 0 : delete mpData;
154 : : else
155 : 2508 : mpData->mnRefCount--;
156 : :
157 : 2508 : mpData = rSet.mpData;
158 : :
159 : 2508 : return *this;
160 : : }
161 : :
162 : : // -----------------------------------------------------------------------
163 : :
164 : 2492 : void MouseSettings::CopyData()
165 : : {
166 : : // copy if another references exist
167 [ + + ]: 2492 : if ( mpData->mnRefCount != 1 )
168 : : {
169 : 2176 : mpData->mnRefCount--;
170 : 2176 : mpData = new ImplMouseData( *mpData );
171 : : }
172 : 2492 : }
173 : :
174 : : // -----------------------------------------------------------------------
175 : :
176 : 42983 : sal_Bool MouseSettings::operator ==( const MouseSettings& rSet ) const
177 : : {
178 [ + + ]: 42983 : if ( mpData == rSet.mpData )
179 : 39407 : return sal_True;
180 : :
181 [ + - ][ + - ]: 3576 : if ( (mpData->mnOptions == rSet.mpData->mnOptions) &&
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + + ]
[ + - ][ + - ]
[ + + ][ + - ]
[ + + ][ + - ]
[ + + ]
182 : : (mpData->mnDoubleClkTime == rSet.mpData->mnDoubleClkTime) &&
183 : : (mpData->mnDoubleClkWidth == rSet.mpData->mnDoubleClkWidth) &&
184 : : (mpData->mnDoubleClkHeight == rSet.mpData->mnDoubleClkHeight) &&
185 : : (mpData->mnStartDragWidth == rSet.mpData->mnStartDragWidth) &&
186 : : (mpData->mnStartDragHeight == rSet.mpData->mnStartDragHeight) &&
187 : : (mpData->mnStartDragCode == rSet.mpData->mnStartDragCode) &&
188 : : (mpData->mnDragMoveCode == rSet.mpData->mnDragMoveCode) &&
189 : : (mpData->mnDragCopyCode == rSet.mpData->mnDragCopyCode) &&
190 : : (mpData->mnDragLinkCode == rSet.mpData->mnDragLinkCode) &&
191 : : (mpData->mnContextMenuCode == rSet.mpData->mnContextMenuCode) &&
192 : : (mpData->mnContextMenuClicks == rSet.mpData->mnContextMenuClicks) &&
193 : : (mpData->mbContextMenuDown == rSet.mpData->mbContextMenuDown) &&
194 : : (mpData->mnMiddleButtonAction == rSet.mpData->mnMiddleButtonAction) &&
195 : : (mpData->mnScrollRepeat == rSet.mpData->mnScrollRepeat) &&
196 : : (mpData->mnButtonStartRepeat == rSet.mpData->mnButtonStartRepeat) &&
197 : : (mpData->mnButtonRepeat == rSet.mpData->mnButtonRepeat) &&
198 : : (mpData->mnActionDelay == rSet.mpData->mnActionDelay) &&
199 : : (mpData->mnMenuDelay == rSet.mpData->mnMenuDelay) &&
200 : : (mpData->mnFollow == rSet.mpData->mnFollow) &&
201 : : (mpData->mnWheelBehavior == rSet.mpData->mnWheelBehavior ) )
202 : 670 : return sal_True;
203 : : else
204 : 42983 : return sal_False;
205 : : }
206 : :
207 : : // =======================================================================
208 : :
209 [ + - ][ + - ]: 251 : ImplStyleData::ImplStyleData()
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
210 : : {
211 : 251 : mnRefCount = 1;
212 : 251 : mnScrollBarSize = 16;
213 : 251 : mnMinThumbSize = 16;
214 : 251 : mnSplitSize = 3;
215 : 251 : mnSpinSize = 16;
216 : 251 : mnIconHorzSpace = 50;
217 : 251 : mnIconVertSpace = 40;
218 : 251 : mnAntialiasedMin = 0;
219 : 251 : mnCursorSize = 2;
220 : 251 : mnCursorBlinkTime = STYLE_CURSOR_NOBLINKTIME;
221 : 251 : mnScreenZoom = 100;
222 : 251 : mnScreenFontZoom = 100;
223 : 251 : mnLogoDisplayTime = LOGO_DISPLAYTIME_STARTTIME;
224 : : mnDragFullOptions = DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE |
225 : : DRAGFULL_OPTION_OBJECTMOVE | DRAGFULL_OPTION_OBJECTSIZE |
226 : : DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT |
227 : 251 : DRAGFULL_OPTION_SCROLL;
228 : 251 : mnAnimationOptions = 0;
229 : 251 : mnSelectionOptions = 0;
230 : 251 : mnDisplayOptions = 0;
231 : 251 : mnOptions = 0;
232 : 251 : mnAutoMnemonic = 1;
233 : 251 : mnToolbarIconSize = STYLE_TOOLBAR_ICONSIZE_UNKNOWN;
234 : 251 : mnSymbolsStyle = STYLE_SYMBOLS_AUTO;
235 : 251 : mnUseImagesInMenus = STYLE_MENUIMAGES_AUTO;
236 : 251 : mnPreferredSymbolsStyle = STYLE_SYMBOLS_AUTO;
237 : 251 : mpFontOptions = NULL;
238 : :
239 [ + - ]: 251 : SetStandardStyles();
240 : 251 : }
241 : :
242 : : // -----------------------------------------------------------------------
243 : :
244 : 37733 : ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
245 : : maActiveBorderColor( rData.maActiveBorderColor ),
246 : : maActiveColor( rData.maActiveColor ),
247 : : maActiveColor2( rData.maActiveColor2 ),
248 : : maActiveTextColor( rData.maActiveTextColor ),
249 : : maButtonTextColor( rData.maButtonTextColor ),
250 : : maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
251 : : maCheckedColor( rData.maCheckedColor ),
252 : : maDarkShadowColor( rData.maDarkShadowColor ),
253 : : maDeactiveBorderColor( rData.maDeactiveBorderColor ),
254 : : maDeactiveColor( rData.maDeactiveColor ),
255 : : maDeactiveColor2( rData.maDeactiveColor2 ),
256 : : maDeactiveTextColor( rData.maDeactiveTextColor ),
257 : : maDialogColor( rData.maDialogColor ),
258 : : maDialogTextColor( rData.maDialogTextColor ),
259 : : maDisableColor( rData.maDisableColor ),
260 : : maFaceColor( rData.maFaceColor ),
261 : : maFieldColor( rData.maFieldColor ),
262 : : maFieldTextColor( rData.maFieldTextColor ),
263 : : maFieldRolloverTextColor( rData.maFieldRolloverTextColor ),
264 : : maFontColor( rData.maFontColor ),
265 : : maGroupTextColor( rData.maGroupTextColor ),
266 : : maHelpColor( rData.maHelpColor ),
267 : : maHelpTextColor( rData.maHelpTextColor ),
268 : : maHighlightColor( rData.maHighlightColor ),
269 : : maHighlightLinkColor( rData.maHighlightLinkColor ),
270 : : maHighlightTextColor( rData.maHighlightTextColor ),
271 : : maInfoTextColor( rData.maInfoTextColor ),
272 : : maLabelTextColor( rData.maLabelTextColor ),
273 : : maLightBorderColor( rData.maLightBorderColor ),
274 : : maLightColor( rData.maLightColor ),
275 : : maLinkColor( rData.maLinkColor ),
276 : : maMenuBarColor( rData.maMenuBarColor ),
277 : : maMenuBorderColor( rData.maMenuBorderColor ),
278 : : maMenuColor( rData.maMenuColor ),
279 : : maMenuHighlightColor( rData.maMenuHighlightColor ),
280 : : maMenuHighlightTextColor( rData.maMenuHighlightTextColor ),
281 : : maMenuTextColor( rData.maMenuTextColor ),
282 : : maMenuBarTextColor( rData.maMenuBarTextColor ),
283 : : maMonoColor( rData.maMonoColor ),
284 : : maRadioCheckTextColor( rData.maRadioCheckTextColor ),
285 : : maShadowColor( rData.maShadowColor ),
286 : : maVisitedLinkColor( rData.maVisitedLinkColor ),
287 : : maWindowColor( rData.maWindowColor ),
288 : : maWindowTextColor( rData.maWindowTextColor ),
289 : : maWorkspaceColor( rData.maWorkspaceColor ),
290 : : maActiveTabColor( rData.maActiveTabColor ),
291 : : maInactiveTabColor( rData.maInactiveTabColor ),
292 : : maAppFont( rData.maAppFont ),
293 : : maHelpFont( rData.maAppFont ),
294 : : maTitleFont( rData.maTitleFont ),
295 : : maFloatTitleFont( rData.maFloatTitleFont ),
296 : : maMenuFont( rData.maMenuFont ),
297 : : maToolFont( rData.maToolFont ),
298 : : maLabelFont( rData.maLabelFont ),
299 : : maInfoFont( rData.maInfoFont ),
300 : : maRadioCheckFont( rData.maRadioCheckFont ),
301 : : maPushButtonFont( rData.maPushButtonFont ),
302 : : maFieldFont( rData.maFieldFont ),
303 : : maIconFont( rData.maIconFont ),
304 : : maGroupFont( rData.maGroupFont ),
305 [ + - ][ + - ]: 37733 : maWorkspaceGradient( rData.maWorkspaceGradient )
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
306 : : {
307 : 37733 : mnRefCount = 1;
308 : 37733 : mnBorderSize = rData.mnBorderSize;
309 : 37733 : mnTitleHeight = rData.mnTitleHeight;
310 : 37733 : mnFloatTitleHeight = rData.mnFloatTitleHeight;
311 : 37733 : mnTearOffTitleHeight = rData.mnTearOffTitleHeight;
312 : 37733 : mnMenuBarHeight = rData.mnMenuBarHeight;
313 : 37733 : mnScrollBarSize = rData.mnScrollBarSize;
314 : 37733 : mnMinThumbSize = rData.mnMinThumbSize;
315 : 37733 : mnSplitSize = rData.mnSplitSize;
316 : 37733 : mnSpinSize = rData.mnSpinSize;
317 : 37733 : mnIconHorzSpace = rData.mnIconHorzSpace;
318 : 37733 : mnIconVertSpace = rData.mnIconVertSpace;
319 : 37733 : mnAntialiasedMin = rData.mnAntialiasedMin;
320 : 37733 : mnCursorSize = rData.mnCursorSize;
321 : 37733 : mnCursorBlinkTime = rData.mnCursorBlinkTime;
322 : 37733 : mnScreenZoom = rData.mnScreenZoom;
323 : 37733 : mnScreenFontZoom = rData.mnScreenFontZoom;
324 : 37733 : mnLogoDisplayTime = rData.mnLogoDisplayTime;
325 : 37733 : mnDragFullOptions = rData.mnDragFullOptions;
326 : 37733 : mnAnimationOptions = rData.mnAnimationOptions;
327 : 37733 : mnSelectionOptions = rData.mnSelectionOptions;
328 : 37733 : mnDisplayOptions = rData.mnDisplayOptions;
329 : 37733 : mnOptions = rData.mnOptions;
330 : 37733 : mnHighContrast = rData.mnHighContrast;
331 : 37733 : mnUseSystemUIFonts = rData.mnUseSystemUIFonts;
332 : 37733 : mnUseFlatBorders = rData.mnUseFlatBorders;
333 : 37733 : mnUseFlatMenues = rData.mnUseFlatMenues;
334 : 37733 : mnAutoMnemonic = rData.mnAutoMnemonic;
335 : 37733 : mnUseImagesInMenus = rData.mnUseImagesInMenus;
336 : 37733 : mbPreferredUseImagesInMenus = rData.mbPreferredUseImagesInMenus;
337 : 37733 : mnSkipDisabledInMenus = rData.mnSkipDisabledInMenus;
338 : 37733 : mbHideDisabledMenuItems = rData.mbHideDisabledMenuItems;
339 : 37733 : mnAcceleratorsInContextMenus = rData.mnAcceleratorsInContextMenus;
340 : 37733 : mnToolbarIconSize = rData.mnToolbarIconSize;
341 : 37733 : mnSymbolsStyle = rData.mnSymbolsStyle;
342 : 37733 : mnPreferredSymbolsStyle = rData.mnPreferredSymbolsStyle;
343 : 37733 : mpFontOptions = rData.mpFontOptions;
344 : 37733 : }
345 : :
346 : : // -----------------------------------------------------------------------
347 : :
348 : 409 : void ImplStyleData::SetStandardStyles()
349 : : {
350 [ + - ]: 409 : Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
351 [ + - ][ + - ]: 409 : aStdFont.SetCharSet( osl_getThreadTextEncoding() );
352 [ + - ]: 409 : aStdFont.SetWeight( WEIGHT_NORMAL );
353 [ + - ][ + - ]: 409 : aStdFont.SetName( utl::DefaultFontConfiguration::get().getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( "en" ), rtl::OUString(), rtl::OUString() ) ) );
[ + - ]
354 [ + - ]: 409 : maAppFont = aStdFont;
355 [ + - ]: 409 : maHelpFont = aStdFont;
356 [ + - ]: 409 : maMenuFont = aStdFont;
357 [ + - ]: 409 : maToolFont = aStdFont;
358 [ + - ]: 409 : maGroupFont = aStdFont;
359 [ + - ]: 409 : maLabelFont = aStdFont;
360 [ + - ]: 409 : maInfoFont = aStdFont;
361 [ + - ]: 409 : maRadioCheckFont = aStdFont;
362 [ + - ]: 409 : maPushButtonFont = aStdFont;
363 [ + - ]: 409 : maFieldFont = aStdFont;
364 [ + - ]: 409 : maIconFont = aStdFont;
365 [ + - ]: 409 : aStdFont.SetWeight( WEIGHT_BOLD );
366 [ + - ]: 409 : maFloatTitleFont = aStdFont;
367 [ + - ]: 409 : maTitleFont = aStdFont;
368 : :
369 : 409 : maFaceColor = Color( COL_LIGHTGRAY );
370 : 409 : maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
371 : 409 : maLightColor = Color( COL_WHITE );
372 : 409 : maLightBorderColor = Color( COL_LIGHTGRAY );
373 : 409 : maShadowColor = Color( COL_GRAY );
374 : 409 : maDarkShadowColor = Color( COL_BLACK );
375 : 409 : maButtonTextColor = Color( COL_BLACK );
376 : 409 : maButtonRolloverTextColor = Color( COL_BLACK );
377 : 409 : maRadioCheckTextColor = Color( COL_BLACK );
378 : 409 : maGroupTextColor = Color( COL_BLACK );
379 : 409 : maLabelTextColor = Color( COL_BLACK );
380 : 409 : maInfoTextColor = Color( COL_BLACK );
381 : 409 : maWindowColor = Color( COL_WHITE );
382 : 409 : maWindowTextColor = Color( COL_BLACK );
383 : 409 : maDialogColor = Color( COL_LIGHTGRAY );
384 : 409 : maDialogTextColor = Color( COL_BLACK );
385 : 409 : maWorkspaceColor = Color( 0xF0, 0xF0, 0xF0 );
386 : 409 : maMonoColor = Color( COL_BLACK );
387 : 409 : maFieldColor = Color( COL_WHITE );
388 : 409 : maFieldTextColor = Color( COL_BLACK );
389 : 409 : maFieldRolloverTextColor = Color( COL_BLACK );
390 : 409 : maActiveColor = Color( COL_BLUE );
391 : 409 : maActiveColor2 = Color( COL_BLACK );
392 : 409 : maActiveTextColor = Color( COL_WHITE );
393 : 409 : maActiveBorderColor = Color( COL_LIGHTGRAY );
394 : 409 : maDeactiveColor = Color( COL_GRAY );
395 : 409 : maDeactiveColor2 = Color( COL_BLACK );
396 : 409 : maDeactiveTextColor = Color( COL_LIGHTGRAY );
397 : 409 : maDeactiveBorderColor = Color( COL_LIGHTGRAY );
398 : 409 : maMenuColor = Color( COL_LIGHTGRAY );
399 : 409 : maMenuBarColor = Color( COL_LIGHTGRAY );
400 : 409 : maMenuBorderColor = Color( COL_LIGHTGRAY );
401 : 409 : maMenuTextColor = Color( COL_BLACK );
402 : 409 : maMenuBarTextColor = Color( COL_BLACK );
403 : 409 : maMenuHighlightColor = Color( COL_BLUE );
404 : 409 : maMenuHighlightTextColor = Color( COL_WHITE );
405 : 409 : maHighlightColor = Color( COL_BLUE );
406 : 409 : maHighlightTextColor = Color( COL_WHITE );
407 : 409 : maActiveTabColor = Color( COL_WHITE );
408 : 409 : maInactiveTabColor = Color( COL_LIGHTGRAY );
409 : 409 : maDisableColor = Color( COL_GRAY );
410 : 409 : maHelpColor = Color( 0xFF, 0xFF, 0xE0 );
411 : 409 : maHelpTextColor = Color( COL_BLACK );
412 : 409 : maLinkColor = Color( COL_BLUE );
413 : 409 : maVisitedLinkColor = Color( 0x00, 0x00, 0xCC );
414 : 409 : maHighlightLinkColor = Color( COL_LIGHTBLUE );
415 : 409 : maFontColor = Color( COL_BLACK );
416 : :
417 : 409 : mnBorderSize = 1;
418 : 409 : mnTitleHeight = 18;
419 : 409 : mnFloatTitleHeight = 13;
420 : 409 : mnTearOffTitleHeight = 8;
421 : 409 : mnMenuBarHeight = 14;
422 : 409 : mnHighContrast = 0;
423 : 409 : mnUseSystemUIFonts = 1;
424 : 409 : mnUseFlatBorders = 0;
425 : 409 : mnUseFlatMenues = 0;
426 : 409 : mbPreferredUseImagesInMenus = sal_True;
427 : 409 : mnSkipDisabledInMenus = (sal_uInt16)sal_False;
428 : 409 : mbHideDisabledMenuItems = sal_False;
429 : 409 : mnAcceleratorsInContextMenus = sal_True;
430 : :
431 [ + - ]: 409 : Gradient aGrad( GradientStyle_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR );
432 [ + - ][ + - ]: 409 : maWorkspaceGradient = Wallpaper( aGrad );
[ + - ][ + - ]
[ + - ]
433 : 409 : }
434 : :
435 : : // -----------------------------------------------------------------------
436 : :
437 : 251 : StyleSettings::StyleSettings()
438 : : {
439 [ + - ]: 251 : mpData = new ImplStyleData();
440 : 251 : }
441 : :
442 : : // -----------------------------------------------------------------------
443 : :
444 : 80003 : StyleSettings::StyleSettings( const StyleSettings& rSet )
445 : : {
446 : : DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "StyleSettings: RefCount overflow" );
447 : :
448 : : // copy shared instance data and increment reference counter
449 : 80003 : mpData = rSet.mpData;
450 : 80003 : mpData->mnRefCount++;
451 : 80003 : }
452 : :
453 : : // -----------------------------------------------------------------------
454 : :
455 : 80013 : StyleSettings::~StyleSettings()
456 : : {
457 : : // if last reference then delete data
458 [ + + ]: 80013 : if ( mpData->mnRefCount == 1 )
459 [ + - ]: 37591 : delete mpData;
460 : : else
461 : 42422 : mpData->mnRefCount--;
462 : 80013 : }
463 : :
464 : : // -----------------------------------------------------------------------
465 : :
466 : 4 : void StyleSettings::Set3DColors( const Color& rColor )
467 : : {
468 : 4 : CopyData();
469 : 4 : mpData->maFaceColor = rColor;
470 : 4 : mpData->maLightBorderColor = rColor;
471 : 4 : mpData->maMenuBorderColor = rColor;
472 : 4 : mpData->maDarkShadowColor = Color( COL_BLACK );
473 [ + - ]: 4 : if ( rColor != Color( COL_LIGHTGRAY ) )
474 : : {
475 : 4 : mpData->maLightColor = rColor;
476 : 4 : mpData->maShadowColor = rColor;
477 : 4 : mpData->maDarkShadowColor=rColor;
478 : 4 : mpData->maLightColor.IncreaseLuminance( 64 );
479 : 4 : mpData->maShadowColor.DecreaseLuminance( 64 );
480 : 4 : mpData->maDarkShadowColor.DecreaseLuminance( 100 );
481 : 4 : sal_uLong nRed = mpData->maLightColor.GetRed();
482 : 4 : sal_uLong nGreen = mpData->maLightColor.GetGreen();
483 : 4 : sal_uLong nBlue = mpData->maLightColor.GetBlue();
484 : 4 : nRed += (sal_uLong)(mpData->maShadowColor.GetRed());
485 : 4 : nGreen += (sal_uLong)(mpData->maShadowColor.GetGreen());
486 : 4 : nBlue += (sal_uLong)(mpData->maShadowColor.GetBlue());
487 : 4 : mpData->maCheckedColor = Color( (sal_uInt8)(nRed/2), (sal_uInt8)(nGreen/2), (sal_uInt8)(nBlue/2) );
488 : : }
489 : : else
490 : : {
491 : 0 : mpData->maCheckedColor = Color( 0x99, 0x99, 0x99 );
492 : 0 : mpData->maLightColor = Color( COL_WHITE );
493 : 0 : mpData->maShadowColor = Color( COL_GRAY );
494 : : }
495 : 4 : }
496 : :
497 : : // -----------------------------------------------------------------------
498 : :
499 : 48792 : ::rtl::OUString StyleSettings::ImplSymbolsStyleToName( sal_uLong nStyle ) const
500 : : {
501 [ + + - + : 48792 : switch ( nStyle )
+ + + +
+ ]
502 : : {
503 : 54 : case STYLE_SYMBOLS_DEFAULT: return ::rtl::OUString("default");
504 : 54 : case STYLE_SYMBOLS_HICONTRAST: return ::rtl::OUString("hicontrast");
505 : 0 : case STYLE_SYMBOLS_INDUSTRIAL: return ::rtl::OUString("tango"); // industrial is dead
506 : 54 : case STYLE_SYMBOLS_CRYSTAL: return ::rtl::OUString("crystal");
507 : 47734 : case STYLE_SYMBOLS_TANGO: return ::rtl::OUString("tango");
508 : 54 : case STYLE_SYMBOLS_OXYGEN: return ::rtl::OUString("oxygen");
509 : 54 : case STYLE_SYMBOLS_CLASSIC: return ::rtl::OUString("classic");
510 : 54 : case STYLE_SYMBOLS_HUMAN: return ::rtl::OUString("human");
511 : : }
512 : :
513 : 48792 : return ::rtl::OUString("auto");
514 : : }
515 : :
516 : : // -----------------------------------------------------------------------
517 : :
518 : 0 : sal_uLong StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) const
519 : : {
520 [ # # ]: 0 : if ( rName == ::rtl::OUString("default") )
521 : 0 : return STYLE_SYMBOLS_DEFAULT;
522 [ # # ]: 0 : else if ( rName == ::rtl::OUString("hicontrast") )
523 : 0 : return STYLE_SYMBOLS_HICONTRAST;
524 [ # # ]: 0 : else if ( rName == ::rtl::OUString("industrial") )
525 : 0 : return STYLE_SYMBOLS_TANGO; // industrial is dead
526 [ # # ]: 0 : else if ( rName == ::rtl::OUString("crystal") )
527 : 0 : return STYLE_SYMBOLS_CRYSTAL;
528 [ # # ]: 0 : else if ( rName == ::rtl::OUString("tango") )
529 : 0 : return STYLE_SYMBOLS_TANGO;
530 [ # # ]: 0 : else if ( rName == ::rtl::OUString("oxygen") )
531 : 0 : return STYLE_SYMBOLS_OXYGEN;
532 [ # # ]: 0 : else if ( rName == ::rtl::OUString("classic") )
533 : 0 : return STYLE_SYMBOLS_CLASSIC;
534 [ # # ]: 0 : else if ( rName == ::rtl::OUString("human") )
535 : 0 : return STYLE_SYMBOLS_HUMAN;
536 : :
537 : 0 : return STYLE_SYMBOLS_AUTO;
538 : : }
539 : :
540 : : // -----------------------------------------------------------------------
541 : :
542 : : /**
543 : : The preferred style name can be read from the desktop setting. We
544 : : need to find the closest theme name registered in OOo. Therefore
545 : : we check if any registered style name is a case-insensitive
546 : : substring of the preferred style name.
547 : : */
548 : 0 : void StyleSettings::SetPreferredSymbolsStyleName( const ::rtl::OUString &rName )
549 : : {
550 [ # # ]: 0 : if ( !rName.isEmpty() )
551 : : {
552 : 0 : ::rtl::OUString rNameLowCase( rName.toAsciiLowerCase() );
553 : :
554 [ # # ]: 0 : for( sal_uInt32 n = 0; n <= STYLE_SYMBOLS_THEMES_MAX; n++ )
555 [ # # ][ # # ]: 0 : if ( rNameLowCase.indexOf( ImplSymbolsStyleToName( n ) ) != -1 )
556 [ # # ]: 0 : SetPreferredSymbolsStyle( n );
557 : : }
558 : 0 : }
559 : :
560 : 0 : void StyleSettings::SetCheckedColorSpecialCase( )
561 : : {
562 : 0 : CopyData();
563 : : // Light gray checked color special case
564 [ # # ]: 0 : if ( GetFaceColor() == COL_LIGHTGRAY )
565 : 0 : mpData->maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
566 : : else
567 : : {
568 : 0 : sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetRed() + (sal_uInt16)mpData->maLightColor.GetRed())/2);
569 : 0 : sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetGreen() + (sal_uInt16)mpData->maLightColor.GetGreen())/2);
570 : 0 : sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetBlue() + (sal_uInt16)mpData->maLightColor.GetBlue())/2);
571 : 0 : mpData->maCheckedColor = Color( nRed, nGreen, nBlue );
572 : : }
573 : 0 : }
574 : :
575 : : // -----------------------------------------------------------------------
576 : :
577 : 192306 : sal_uLong StyleSettings::GetCurrentSymbolsStyle() const
578 : : {
579 : : // style selected in Tools -> Options... -> OpenOffice.org -> View
580 : 192306 : sal_uLong nStyle = GetSymbolsStyle();
581 : :
582 [ # # ][ + - ]: 192306 : if ( nStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nStyle) ) )
[ - + ]
583 : : {
584 : : // the preferred style can be read from the desktop setting by the desktop native widgets modules
585 : 192306 : sal_uLong nPreferredStyle = GetPreferredSymbolsStyle();
586 : :
587 [ # # ][ + - ]: 192306 : if ( nPreferredStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nPreferredStyle) ) )
[ - + ]
588 : : {
589 : :
590 : : // use a hardcoded desktop-specific fallback if no preferred style has been detected
591 : : static bool sbFallbackDesktopChecked = false;
592 : : static sal_uLong snFallbackDesktopStyle = STYLE_SYMBOLS_DEFAULT;
593 : :
594 [ + + ]: 192306 : if ( !sbFallbackDesktopChecked )
595 : : {
596 : 116 : snFallbackDesktopStyle = GetAutoSymbolsStyle();
597 : 116 : sbFallbackDesktopChecked = true;
598 : : }
599 : :
600 : 192306 : nPreferredStyle = snFallbackDesktopStyle;
601 : : }
602 : :
603 [ - + ][ # # ]: 192306 : if (GetHighContrastMode() && CheckSymbolStyle (STYLE_SYMBOLS_HICONTRAST) )
[ - + ]
604 : 0 : nStyle = STYLE_SYMBOLS_HICONTRAST;
605 : : else
606 : 192306 : nStyle = nPreferredStyle;
607 : : }
608 : :
609 : 192306 : return nStyle;
610 : : }
611 : :
612 : : // -----------------------------------------------------------------------
613 : :
614 : 116 : sal_uLong StyleSettings::GetAutoSymbolsStyle() const
615 : : {
616 : 116 : rtl::OUString const & env = Application::GetDesktopEnvironment();
617 : :
618 : : sal_uLong nRet;
619 [ - + ]: 232 : if ( env.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("tde")) ||
[ + - - + ]
620 : 116 : env.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("kde")) )
621 : 0 : nRet = STYLE_SYMBOLS_CRYSTAL;
622 [ - + ]: 116 : else if ( env.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("kde4")) )
623 : 0 : nRet = STYLE_SYMBOLS_OXYGEN;
624 : : else
625 : 116 : nRet = STYLE_SYMBOLS_TANGO;
626 : :
627 : : // falback to any existing style
628 [ + + ]: 116 : if ( ! CheckSymbolStyle (nRet) )
629 : : {
630 [ + + ]: 594 : for ( sal_uLong n = 0 ; n <= STYLE_SYMBOLS_THEMES_MAX ; n++ )
631 : : {
632 : 540 : sal_uLong nStyleToCheck = n;
633 : :
634 : : // auto is not a real theme => can't be fallback
635 [ + + ]: 540 : if ( nStyleToCheck == STYLE_SYMBOLS_AUTO )
636 : 54 : continue;
637 : :
638 : : // will check hicontrast in the end
639 [ + + ]: 486 : if ( nStyleToCheck == STYLE_SYMBOLS_HICONTRAST )
640 : 54 : continue;
641 [ + + ]: 432 : if ( nStyleToCheck == STYLE_SYMBOLS_THEMES_MAX )
642 : 54 : nStyleToCheck = STYLE_SYMBOLS_HICONTRAST;
643 : :
644 [ - + ]: 432 : if ( CheckSymbolStyle ( nStyleToCheck ) )
645 : : {
646 : 0 : nRet = nStyleToCheck;
647 : 0 : n = STYLE_SYMBOLS_THEMES_MAX;
648 : : }
649 : : }
650 : : }
651 : :
652 : 116 : return nRet;
653 : : }
654 : :
655 : : // -----------------------------------------------------------------------
656 : :
657 : 548 : bool StyleSettings::CheckSymbolStyle( sal_uLong nStyle ) const
658 : : {
659 [ + + ]: 548 : if ( nStyle == STYLE_SYMBOLS_INDUSTRIAL )
660 : 54 : return false; // industrial is dead
661 : :
662 [ + + ][ + - ]: 494 : static ImplImageTreeSingletonRef aImageTree;
[ + - ][ # # ]
663 [ + - ][ + - ]: 548 : return aImageTree->checkStyle( ImplSymbolsStyleToName( nStyle ) );
664 : : }
665 : :
666 : : // -----------------------------------------------------------------------
667 : :
668 : 47791 : sal_Bool StyleSettings::GetUseImagesInMenus() const
669 : : {
670 : : // icon mode selected in Tools -> Options... -> OpenOffice.org -> View
671 : 47791 : sal_uInt16 nStyle = mpData->mnUseImagesInMenus;
672 : :
673 [ + - ]: 47791 : if ( nStyle == STYLE_MENUIMAGES_AUTO )
674 : 47791 : return GetPreferredUseImagesInMenus();
675 : :
676 : 47791 : return (sal_Bool)nStyle;
677 : : }
678 : :
679 : : // -----------------------------------------------------------------------
680 : :
681 : 158 : void StyleSettings::SetStandardStyles()
682 : : {
683 : 158 : CopyData();
684 : 158 : mpData->SetStandardStyles();
685 : 158 : }
686 : :
687 : : // -----------------------------------------------------------------------
688 : :
689 : 145902 : Color StyleSettings::GetFaceGradientColor() const
690 : : {
691 : : // compute a brighter face color that can be used in gradients
692 : : // for a convex look (eg toolbars)
693 : :
694 : : sal_uInt16 h, s, b;
695 [ + - ]: 145902 : GetFaceColor().RGBtoHSB( h, s, b );
696 [ - + ]: 145902 : if( s > 1) s=1;
697 [ + - ]: 145902 : if( b < 98) b=98;
698 [ + - ]: 145902 : return Color( Color::HSBtoRGB( h, s, b ) );
699 : : }
700 : :
701 : : // -----------------------------------------------------------------------
702 : :
703 : 27894 : Color StyleSettings::GetSeparatorColor() const
704 : : {
705 : : // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP)
706 : : sal_uInt16 h, s, b;
707 [ + - ]: 27894 : GetShadowColor().RGBtoHSB( h, s, b );
708 : 27894 : b += b/4;
709 : 27894 : s -= s/4;
710 [ + - ]: 27894 : return Color( Color::HSBtoRGB( h, s, b ) );
711 : : }
712 : :
713 : : // -----------------------------------------------------------------------
714 : :
715 : 38047 : const StyleSettings& StyleSettings::operator =( const StyleSettings& rSet )
716 : : {
717 : : DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "StyleSettings: RefCount overflow" );
718 : :
719 : : // increase reference counter first, to be able to assign oneself
720 : 38047 : rSet.mpData->mnRefCount++;
721 : :
722 : : // if last reference then delete data
723 [ + + ]: 38047 : if ( mpData->mnRefCount == 1 )
724 [ + - ]: 158 : delete mpData;
725 : : else
726 : 37889 : mpData->mnRefCount--;
727 : :
728 : 38047 : mpData = rSet.mpData;
729 : :
730 : 38047 : return *this;
731 : : }
732 : :
733 : : // -----------------------------------------------------------------------
734 : :
735 : 42954 : void StyleSettings::CopyData()
736 : : {
737 : : // copy if other references exist
738 [ + + ]: 42954 : if ( mpData->mnRefCount != 1 )
739 : : {
740 : 37733 : mpData->mnRefCount--;
741 [ + - ]: 37733 : mpData = new ImplStyleData( *mpData );
742 : : }
743 : 42954 : }
744 : :
745 : : // -----------------------------------------------------------------------
746 : :
747 : : inline sal_Bool ImplIsBackOrWhite( const Color& rColor )
748 : : {
749 : : sal_uInt8 nLuminance = rColor.GetLuminance();
750 : : return ( nLuminance < 8 ) || ( nLuminance > 250 );
751 : : }
752 : :
753 : : // -----------------------------------------------------------------------
754 : :
755 : 42983 : sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const
756 : : {
757 [ + + ]: 42983 : if ( mpData == rSet.mpData )
758 : 4271 : return sal_True;
759 : :
760 [ + + ][ + - ]: 2246314 : if ( (mpData->mnOptions == rSet.mpData->mnOptions) &&
[ + - ][ + + ]
[ + - ][ + + ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + + ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - + +
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
+ + - + -
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - ][ + - ]
[ + - ][ + - ]
[ + - ]
[ + - + - ]
[ + + ]
761 : : (mpData->mnAutoMnemonic == rSet.mpData->mnAutoMnemonic) &&
762 : : (mpData->mnLogoDisplayTime == rSet.mpData->mnLogoDisplayTime) &&
763 : : (mpData->mnDragFullOptions == rSet.mpData->mnDragFullOptions) &&
764 : : (mpData->mnAnimationOptions == rSet.mpData->mnAnimationOptions) &&
765 : : (mpData->mnSelectionOptions == rSet.mpData->mnSelectionOptions) &&
766 : : (mpData->mnDisplayOptions == rSet.mpData->mnDisplayOptions) &&
767 : : (mpData->mnCursorSize == rSet.mpData->mnCursorSize) &&
768 : : (mpData->mnCursorBlinkTime == rSet.mpData->mnCursorBlinkTime) &&
769 : : (mpData->mnBorderSize == rSet.mpData->mnBorderSize) &&
770 : : (mpData->mnTitleHeight == rSet.mpData->mnTitleHeight) &&
771 : : (mpData->mnFloatTitleHeight == rSet.mpData->mnFloatTitleHeight) &&
772 : : (mpData->mnTearOffTitleHeight == rSet.mpData->mnTearOffTitleHeight) &&
773 : : (mpData->mnMenuBarHeight == rSet.mpData->mnMenuBarHeight) &&
774 : : (mpData->mnScrollBarSize == rSet.mpData->mnScrollBarSize) &&
775 : : (mpData->mnMinThumbSize == rSet.mpData->mnMinThumbSize) &&
776 : : (mpData->mnSplitSize == rSet.mpData->mnSplitSize) &&
777 : : (mpData->mnSpinSize == rSet.mpData->mnSpinSize) &&
778 : : (mpData->mnIconHorzSpace == rSet.mpData->mnIconHorzSpace) &&
779 : : (mpData->mnIconVertSpace == rSet.mpData->mnIconVertSpace) &&
780 : : (mpData->mnAntialiasedMin == rSet.mpData->mnAntialiasedMin) &&
781 : : (mpData->mnScreenZoom == rSet.mpData->mnScreenZoom) &&
782 : : (mpData->mnScreenFontZoom == rSet.mpData->mnScreenFontZoom) &&
783 : : (mpData->mnHighContrast == rSet.mpData->mnHighContrast) &&
784 : : (mpData->mnUseSystemUIFonts == rSet.mpData->mnUseSystemUIFonts) &&
785 : : (mpData->mnUseFlatBorders == rSet.mpData->mnUseFlatBorders) &&
786 : : (mpData->mnUseFlatMenues == rSet.mpData->mnUseFlatMenues) &&
787 : : (mpData->mnSymbolsStyle == rSet.mpData->mnSymbolsStyle) &&
788 : : (mpData->mnPreferredSymbolsStyle == rSet.mpData->mnPreferredSymbolsStyle) &&
789 : 38104 : (mpData->maFaceColor == rSet.mpData->maFaceColor) &&
790 : 38086 : (mpData->maCheckedColor == rSet.mpData->maCheckedColor) &&
791 : 38086 : (mpData->maLightColor == rSet.mpData->maLightColor) &&
792 : 38086 : (mpData->maLightBorderColor == rSet.mpData->maLightBorderColor) &&
793 : 38086 : (mpData->maShadowColor == rSet.mpData->maShadowColor) &&
794 : 38086 : (mpData->maDarkShadowColor == rSet.mpData->maDarkShadowColor) &&
795 : 38086 : (mpData->maButtonTextColor == rSet.mpData->maButtonTextColor) &&
796 : 38086 : (mpData->maRadioCheckTextColor == rSet.mpData->maRadioCheckTextColor) &&
797 : 38086 : (mpData->maGroupTextColor == rSet.mpData->maGroupTextColor) &&
798 : 38086 : (mpData->maLabelTextColor == rSet.mpData->maLabelTextColor) &&
799 : 38086 : (mpData->maInfoTextColor == rSet.mpData->maInfoTextColor) &&
800 : 38086 : (mpData->maWindowColor == rSet.mpData->maWindowColor) &&
801 : 38086 : (mpData->maWindowTextColor == rSet.mpData->maWindowTextColor) &&
802 : 38086 : (mpData->maDialogColor == rSet.mpData->maDialogColor) &&
803 : 38086 : (mpData->maDialogTextColor == rSet.mpData->maDialogTextColor) &&
804 : 38086 : (mpData->maWorkspaceColor == rSet.mpData->maWorkspaceColor) &&
805 : 38086 : (mpData->maMonoColor == rSet.mpData->maMonoColor) &&
806 : 38086 : (mpData->maFieldColor == rSet.mpData->maFieldColor) &&
807 : 38086 : (mpData->maFieldTextColor == rSet.mpData->maFieldTextColor) &&
808 : 38050 : (mpData->maActiveColor == rSet.mpData->maActiveColor) &&
809 : 38050 : (mpData->maActiveColor2 == rSet.mpData->maActiveColor2) &&
810 : 38050 : (mpData->maActiveTextColor == rSet.mpData->maActiveTextColor) &&
811 : 38050 : (mpData->maActiveBorderColor == rSet.mpData->maActiveBorderColor) &&
812 : 38050 : (mpData->maDeactiveColor == rSet.mpData->maDeactiveColor) &&
813 : 38050 : (mpData->maDeactiveColor2 == rSet.mpData->maDeactiveColor2) &&
814 : 38050 : (mpData->maDeactiveTextColor == rSet.mpData->maDeactiveTextColor) &&
815 : 38050 : (mpData->maDeactiveBorderColor == rSet.mpData->maDeactiveBorderColor) &&
816 : 38050 : (mpData->maMenuColor == rSet.mpData->maMenuColor) &&
817 : 38050 : (mpData->maMenuBarColor == rSet.mpData->maMenuBarColor) &&
818 : 38050 : (mpData->maMenuBorderColor == rSet.mpData->maMenuBorderColor) &&
819 : 38050 : (mpData->maMenuTextColor == rSet.mpData->maMenuTextColor) &&
820 : 38050 : (mpData->maMenuBarTextColor == rSet.mpData->maMenuBarTextColor) &&
821 : 38050 : (mpData->maMenuHighlightColor == rSet.mpData->maMenuHighlightColor) &&
822 : 38050 : (mpData->maMenuHighlightTextColor == rSet.mpData->maMenuHighlightTextColor) &&
823 : 38050 : (mpData->maHighlightColor == rSet.mpData->maHighlightColor) &&
824 : 38050 : (mpData->maHighlightTextColor == rSet.mpData->maHighlightTextColor) &&
825 : 38050 : (mpData->maActiveTabColor == rSet.mpData->maActiveTabColor) &&
826 : 38050 : (mpData->maInactiveTabColor == rSet.mpData->maInactiveTabColor) &&
827 : 38050 : (mpData->maDisableColor == rSet.mpData->maDisableColor) &&
828 : 38050 : (mpData->maHelpColor == rSet.mpData->maHelpColor) &&
829 : 38050 : (mpData->maHelpTextColor == rSet.mpData->maHelpTextColor) &&
830 : 38050 : (mpData->maLinkColor == rSet.mpData->maLinkColor) &&
831 : 38050 : (mpData->maVisitedLinkColor == rSet.mpData->maVisitedLinkColor) &&
832 : 38050 : (mpData->maHighlightLinkColor == rSet.mpData->maHighlightLinkColor) &&
833 : 38050 : (mpData->maAppFont == rSet.mpData->maAppFont) &&
834 : 38050 : (mpData->maHelpFont == rSet.mpData->maHelpFont) &&
835 : 38050 : (mpData->maTitleFont == rSet.mpData->maTitleFont) &&
836 : 38050 : (mpData->maFloatTitleFont == rSet.mpData->maFloatTitleFont) &&
837 : 38050 : (mpData->maMenuFont == rSet.mpData->maMenuFont) &&
838 : 38050 : (mpData->maToolFont == rSet.mpData->maToolFont) &&
839 : 38050 : (mpData->maGroupFont == rSet.mpData->maGroupFont) &&
840 : 38050 : (mpData->maLabelFont == rSet.mpData->maLabelFont) &&
841 : 38050 : (mpData->maInfoFont == rSet.mpData->maInfoFont) &&
842 : 38050 : (mpData->maRadioCheckFont == rSet.mpData->maRadioCheckFont) &&
843 : 38050 : (mpData->maPushButtonFont == rSet.mpData->maPushButtonFont) &&
844 : 38050 : (mpData->maFieldFont == rSet.mpData->maFieldFont) &&
845 : 38050 : (mpData->maIconFont == rSet.mpData->maIconFont) &&
846 : : (mpData->mnUseImagesInMenus == rSet.mpData->mnUseImagesInMenus) &&
847 : : (mpData->mbPreferredUseImagesInMenus == rSet.mpData->mbPreferredUseImagesInMenus) &&
848 : : (mpData->mnSkipDisabledInMenus == rSet.mpData->mnSkipDisabledInMenus) &&
849 : : (mpData->mbHideDisabledMenuItems == rSet.mpData->mbHideDisabledMenuItems) &&
850 : : (mpData->mnAcceleratorsInContextMenus == rSet.mpData->mnAcceleratorsInContextMenus) &&
851 : 38050 : (mpData->maFontColor == rSet.mpData->maFontColor ))
852 : 38050 : return sal_True;
853 : : else
854 : 42983 : return sal_False;
855 : : }
856 : :
857 : : // =======================================================================
858 : :
859 : 251 : ImplMiscData::ImplMiscData()
860 : : {
861 : 251 : mnRefCount = 1;
862 : 251 : mnEnableATT = sal::static_int_cast<sal_uInt16>(~0U);
863 : 251 : mnDisablePrinting = sal::static_int_cast<sal_uInt16>(~0U);
864 [ + - ][ + - ]: 251 : static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
865 [ - + ]: 251 : mbEnableLocalizedDecimalSep = (pEnv != NULL) ? sal_True : sal_False;
866 : 251 : }
867 : :
868 : : // -----------------------------------------------------------------------
869 : :
870 : 0 : ImplMiscData::ImplMiscData( const ImplMiscData& rData )
871 : : {
872 : 0 : mnRefCount = 1;
873 : 0 : mnEnableATT = rData.mnEnableATT;
874 : 0 : mnDisablePrinting = rData.mnDisablePrinting;
875 : 0 : mbEnableLocalizedDecimalSep = rData.mbEnableLocalizedDecimalSep;
876 : 0 : }
877 : :
878 : : // -----------------------------------------------------------------------
879 : :
880 : 251 : MiscSettings::MiscSettings()
881 : : {
882 [ + - ]: 251 : mpData = new ImplMiscData();
883 : 251 : }
884 : :
885 : : // -----------------------------------------------------------------------
886 : :
887 : 38756 : MiscSettings::MiscSettings( const MiscSettings& rSet )
888 : : {
889 : : DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "MiscSettings: RefCount overflow" );
890 : :
891 : : // copy shared instance data and increment reference counter
892 : 38756 : mpData = rSet.mpData;
893 : 38756 : mpData->mnRefCount++;
894 : 38756 : }
895 : :
896 : : // -----------------------------------------------------------------------
897 : :
898 : 38766 : MiscSettings::~MiscSettings()
899 : : {
900 : : // if last reference then delete data
901 [ + + ]: 38766 : if ( mpData->mnRefCount == 1 )
902 : 154 : delete mpData;
903 : : else
904 : 38612 : mpData->mnRefCount--;
905 : 38766 : }
906 : :
907 : : // -----------------------------------------------------------------------
908 : :
909 : 0 : const MiscSettings& MiscSettings::operator =( const MiscSettings& rSet )
910 : : {
911 : : DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "MiscSettings: RefCount overflow" );
912 : :
913 : : // increase reference counter first, to be able to assign oneself
914 : 0 : rSet.mpData->mnRefCount++;
915 : :
916 : : // if last reference then delete data
917 [ # # ]: 0 : if ( mpData->mnRefCount == 1 )
918 : 0 : delete mpData;
919 : : else
920 : 0 : mpData->mnRefCount--;
921 : :
922 : 0 : mpData = rSet.mpData;
923 : :
924 : 0 : return *this;
925 : : }
926 : :
927 : : // -----------------------------------------------------------------------
928 : :
929 : 251 : void MiscSettings::CopyData()
930 : : {
931 : : // copy if other references exist
932 [ - + ]: 251 : if ( mpData->mnRefCount != 1 )
933 : : {
934 : 0 : mpData->mnRefCount--;
935 : 0 : mpData = new ImplMiscData( *mpData );
936 : : }
937 : 251 : }
938 : :
939 : : // -----------------------------------------------------------------------
940 : :
941 : 42983 : sal_Bool MiscSettings::operator ==( const MiscSettings& rSet ) const
942 : : {
943 [ + - ]: 42983 : if ( mpData == rSet.mpData )
944 : 42983 : return sal_True;
945 : :
946 [ # # ][ # # ]: 0 : if ( (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) &&
[ # # ]
947 : : (mpData->mnDisablePrinting == rSet.mpData->mnDisablePrinting ) &&
948 : : (mpData->mbEnableLocalizedDecimalSep == rSet.mpData->mbEnableLocalizedDecimalSep ) )
949 : 0 : return sal_True;
950 : : else
951 : 42983 : return sal_False;
952 : : }
953 : :
954 : : // -----------------------------------------------------------------------
955 : :
956 : 3384 : sal_Bool MiscSettings::GetDisablePrinting() const
957 : : {
958 [ + + ]: 3384 : if( mpData->mnDisablePrinting == (sal_uInt16)~0 )
959 : : {
960 : : rtl::OUString aEnable =
961 : : vcl::SettingsConfigItem::get()->
962 : : getValue( rtl::OUString( "DesktopManagement" ),
963 [ + - ][ + - ]: 60 : rtl::OUString( "DisablePrinting" ) );
964 [ - + ]: 60 : mpData->mnDisablePrinting = aEnable.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("true")) ? 1 : 0;
965 : : }
966 : :
967 : 3384 : return (sal_Bool)mpData->mnDisablePrinting;
968 : : }
969 : : // -----------------------------------------------------------------------
970 : :
971 : 43559 : sal_Bool MiscSettings::GetEnableATToolSupport() const
972 : : {
973 : :
974 : : #ifdef WNT
975 : : if( mpData->mnEnableATT == (sal_uInt16)~0 )
976 : : {
977 : : // Check in the Windows registry if an AT tool wants Accessibility support to
978 : : // be activated ..
979 : : HKEY hkey;
980 : :
981 : : if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,
982 : : "Software\\LibreOffice\\Accessibility\\AtToolSupport",
983 : : &hkey) )
984 : : {
985 : : DWORD dwType;
986 : : sal_uInt8 Data[6]; // possible values: "true", "false", "1", "0", DWORD
987 : : DWORD cbData = sizeof(Data);
988 : :
989 : : if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
990 : : NULL, &dwType, Data, &cbData) )
991 : : {
992 : : switch (dwType)
993 : : {
994 : : case REG_SZ:
995 : : mpData->mnEnableATT = ((0 == stricmp((const char *) Data, "1")) || (0 == stricmp((const char *) Data, "true")));
996 : : break;
997 : : case REG_DWORD:
998 : : mpData->mnEnableATT = (sal_uInt16) (((DWORD *) Data)[0]);
999 : : break;
1000 : : default:
1001 : : // Unsupported registry type
1002 : : break;
1003 : : }
1004 : : }
1005 : :
1006 : : RegCloseKey(hkey);
1007 : : }
1008 : : }
1009 : : #endif
1010 : :
1011 [ + + ]: 43559 : if( mpData->mnEnableATT == (sal_uInt16)~0 )
1012 : : {
1013 [ + - ][ + - ]: 209 : static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" );
1014 [ - + ][ # # ]: 209 : if( !pEnv || !*pEnv )
1015 : : {
1016 : : rtl::OUString aEnable =
1017 : : vcl::SettingsConfigItem::get()->
1018 : : getValue( rtl::OUString( "Accessibility" ),
1019 [ + - ][ + - ]: 209 : rtl::OUString( "EnableATToolSupport" ) );
1020 [ - + ]: 209 : mpData->mnEnableATT = aEnable.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("true")) ? 1 : 0;
1021 : : }
1022 : : else
1023 : : {
1024 : 209 : mpData->mnEnableATT = 1;
1025 : : }
1026 : : }
1027 : :
1028 : 43559 : return (sal_Bool)mpData->mnEnableATT;
1029 : : }
1030 : :
1031 : : #ifdef WNT
1032 : : void MiscSettings::SetEnableATToolSupport( sal_Bool bEnable )
1033 : : {
1034 : : if ( bEnable != mpData->mnEnableATT )
1035 : : {
1036 : : sal_Bool bDummy;
1037 : : if( bEnable && !ImplInitAccessBridge(false, bDummy) )
1038 : : return;
1039 : :
1040 : : HKEY hkey;
1041 : :
1042 : : // If the accessibility key in the Windows registry exists, change it synchronously
1043 : : if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,
1044 : : "Software\\LibreOffice\\Accessibility\\AtToolSupport",
1045 : : &hkey) )
1046 : : {
1047 : : DWORD dwType;
1048 : : sal_uInt8 Data[6]; // possible values: "true", "false", 1, 0
1049 : : DWORD cbData = sizeof(Data);
1050 : :
1051 : : if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
1052 : : NULL, &dwType, Data, &cbData) )
1053 : : {
1054 : : switch (dwType)
1055 : : {
1056 : : case REG_SZ:
1057 : : RegSetValueEx(hkey, "SupportAssistiveTechnology",
1058 : : 0, dwType,
1059 : : bEnable ? (sal_uInt8 *) "true" : (sal_uInt8 *) "false",
1060 : : bEnable ? sizeof("true") : sizeof("false"));
1061 : : break;
1062 : : case REG_DWORD:
1063 : : ((DWORD *) Data)[0] = bEnable ? 1 : 0;
1064 : : RegSetValueEx(hkey, "SupportAssistiveTechnology",
1065 : : 0, dwType, Data, sizeof(DWORD));
1066 : : break;
1067 : : default:
1068 : : // Unsupported registry type
1069 : : break;
1070 : : }
1071 : : }
1072 : :
1073 : : RegCloseKey(hkey);
1074 : : }
1075 : :
1076 : : vcl::SettingsConfigItem::get()->
1077 : : setValue( rtl::OUString( "Accessibility" ),
1078 : : rtl::OUString( "EnableATToolSupport" ),
1079 : : bEnable ? rtl::OUString("true") : rtl::OUString("false" ) );
1080 : : mpData->mnEnableATT = bEnable ? 1 : 0;
1081 : : }
1082 : : }
1083 : : #endif
1084 : :
1085 : 251 : void MiscSettings::SetEnableLocalizedDecimalSep( sal_Bool bEnable )
1086 : : {
1087 : 251 : CopyData();
1088 : 251 : mpData->mbEnableLocalizedDecimalSep = bEnable;
1089 : 251 : }
1090 : :
1091 : 0 : sal_Bool MiscSettings::GetEnableLocalizedDecimalSep() const
1092 : : {
1093 : 0 : return mpData->mbEnableLocalizedDecimalSep;
1094 : : }
1095 : :
1096 : : // =======================================================================
1097 : :
1098 : 251 : ImplHelpData::ImplHelpData()
1099 : : {
1100 : 251 : mnRefCount = 1;
1101 : 251 : mnOptions = 0;
1102 : 251 : mnTipDelay = 500;
1103 : 251 : mnTipTimeout = 3000;
1104 : 251 : mnBalloonDelay = 1500;
1105 : 251 : }
1106 : :
1107 : : // -----------------------------------------------------------------------
1108 : :
1109 : 158 : ImplHelpData::ImplHelpData( const ImplHelpData& rData )
1110 : : {
1111 : 158 : mnRefCount = 1;
1112 : 158 : mnOptions = rData.mnOptions;
1113 : 158 : mnTipDelay = rData.mnTipDelay;
1114 : 158 : mnTipTimeout = rData.mnTipTimeout;
1115 : 158 : mnBalloonDelay = rData.mnBalloonDelay;
1116 : 158 : }
1117 : :
1118 : : // -----------------------------------------------------------------------
1119 : :
1120 : 251 : HelpSettings::HelpSettings()
1121 : : {
1122 : 251 : mpData = new ImplHelpData();
1123 : 251 : }
1124 : :
1125 : : // -----------------------------------------------------------------------
1126 : :
1127 : 38914 : HelpSettings::HelpSettings( const HelpSettings& rSet )
1128 : : {
1129 : : DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "HelpSettings: RefCount overflow" );
1130 : :
1131 : : // copy shared instance data and increment reference counter
1132 : 38914 : mpData = rSet.mpData;
1133 : 38914 : mpData->mnRefCount++;
1134 : 38914 : }
1135 : :
1136 : : // -----------------------------------------------------------------------
1137 : :
1138 : 38924 : HelpSettings::~HelpSettings()
1139 : : {
1140 : : // if last reference then delete data
1141 [ + + ]: 38924 : if ( mpData->mnRefCount == 1 )
1142 : 312 : delete mpData;
1143 : : else
1144 : 38612 : mpData->mnRefCount--;
1145 : 38924 : }
1146 : :
1147 : : // -----------------------------------------------------------------------
1148 : :
1149 : 474 : const HelpSettings& HelpSettings::operator =( const HelpSettings& rSet )
1150 : : {
1151 : : DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "HelpSettings: RefCount overflow" );
1152 : :
1153 : : // increase reference counter first, to be able to assign oneself
1154 : 474 : rSet.mpData->mnRefCount++;
1155 : :
1156 : : // delete data if last reference
1157 [ - + ]: 474 : if ( mpData->mnRefCount == 1 )
1158 : 0 : delete mpData;
1159 : : else
1160 : 474 : mpData->mnRefCount--;
1161 : :
1162 : 474 : mpData = rSet.mpData;
1163 : :
1164 : 474 : return *this;
1165 : : }
1166 : :
1167 : : // -----------------------------------------------------------------------
1168 : :
1169 : 158 : void HelpSettings::CopyData()
1170 : : {
1171 : : // copy of other references exist
1172 [ + - ]: 158 : if ( mpData->mnRefCount != 1 )
1173 : : {
1174 : 158 : mpData->mnRefCount--;
1175 : 158 : mpData = new ImplHelpData( *mpData );
1176 : : }
1177 : 158 : }
1178 : :
1179 : : // -----------------------------------------------------------------------
1180 : :
1181 : 42983 : sal_Bool HelpSettings::operator ==( const HelpSettings& rSet ) const
1182 : : {
1183 [ + + ]: 42983 : if ( mpData == rSet.mpData )
1184 : 42509 : return sal_True;
1185 : :
1186 [ + - ][ + - ]: 474 : if ( (mpData->mnOptions == rSet.mpData->mnOptions ) &&
[ - + ][ # # ]
1187 : : (mpData->mnTipDelay == rSet.mpData->mnTipDelay ) &&
1188 : : (mpData->mnTipTimeout == rSet.mpData->mnTipTimeout ) &&
1189 : : (mpData->mnBalloonDelay == rSet.mpData->mnBalloonDelay ) )
1190 : 0 : return sal_True;
1191 : : else
1192 : 42983 : return sal_False;
1193 : : }
1194 : :
1195 : : // =======================================================================
1196 : :
1197 [ + - ][ + - ]: 251 : ImplAllSettingsData::ImplAllSettingsData()
[ + - ][ + - ]
1198 : : {
1199 : 251 : mnRefCount = 1;
1200 : 251 : mnSystemUpdate = SETTINGS_ALLSETTINGS;
1201 : 251 : mnWindowUpdate = SETTINGS_ALLSETTINGS;
1202 : 251 : meLanguage = LANGUAGE_SYSTEM;
1203 : 251 : meUILanguage = LANGUAGE_SYSTEM;
1204 : 251 : mpLocaleDataWrapper = NULL;
1205 : 251 : mpUILocaleDataWrapper = NULL;
1206 : 251 : mpI18nHelper = NULL;
1207 : 251 : mpUII18nHelper = NULL;
1208 [ + - ][ + - ]: 251 : maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
[ + - ]
1209 : 251 : }
1210 : :
1211 : : // -----------------------------------------------------------------------
1212 : :
1213 : 38756 : ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
1214 : : maMouseSettings( rData.maMouseSettings ),
1215 : : maStyleSettings( rData.maStyleSettings ),
1216 : : maMiscSettings( rData.maMiscSettings ),
1217 : : maHelpSettings( rData.maHelpSettings ),
1218 [ + - ][ + - ]: 38756 : maLocale( rData.maLocale )
[ + - ][ + - ]
1219 : : {
1220 : 38756 : mnRefCount = 1;
1221 : 38756 : mnSystemUpdate = rData.mnSystemUpdate;
1222 : 38756 : mnWindowUpdate = rData.mnWindowUpdate;
1223 : 38756 : meLanguage = rData.meLanguage;
1224 : : // Pointer couldn't shared and objects haven't a copy ctor
1225 : : // So we create the cache objects new, if the GetFunction is
1226 : : // called
1227 : 38756 : mpLocaleDataWrapper = NULL;
1228 : 38756 : mpUILocaleDataWrapper = NULL;
1229 : 38756 : mpI18nHelper = NULL;
1230 : 38756 : mpUII18nHelper = NULL;
1231 : 38756 : }
1232 : :
1233 : : // -----------------------------------------------------------------------
1234 : :
1235 [ + - ][ + - ]: 38766 : ImplAllSettingsData::~ImplAllSettingsData()
[ + - ][ + - ]
1236 : : {
1237 [ + + ][ + - ]: 38766 : delete mpLocaleDataWrapper;
1238 [ - + ][ # # ]: 38766 : delete mpUILocaleDataWrapper;
1239 [ + + ]: 38766 : if ( mpI18nHelper )
1240 [ + - ][ + - ]: 96 : delete mpI18nHelper;
1241 [ - + ]: 38766 : if ( mpUII18nHelper )
1242 [ # # ][ # # ]: 0 : delete mpUII18nHelper;
1243 : 38766 : }
1244 : :
1245 : : // -----------------------------------------------------------------------
1246 : :
1247 : 251 : AllSettings::AllSettings()
1248 : : {
1249 : : DBG_CTOR( AllSettings, NULL );
1250 : :
1251 [ + - ]: 251 : mpData = new ImplAllSettingsData();
1252 : 251 : }
1253 : :
1254 : : // -----------------------------------------------------------------------
1255 : :
1256 : 299182 : AllSettings::AllSettings( const AllSettings& rSet )
1257 : : {
1258 : : DBG_CTOR( AllSettings, NULL );
1259 : : DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "Settings: RefCount overflow" );
1260 : :
1261 : : // copy shared instance data and increse reference counter
1262 : 299182 : mpData = rSet.mpData;
1263 : 299182 : mpData->mnRefCount++;
1264 : 299182 : }
1265 : :
1266 : : // -----------------------------------------------------------------------
1267 : :
1268 : 294979 : AllSettings::~AllSettings()
1269 : : {
1270 : : DBG_DTOR( AllSettings, NULL );
1271 : :
1272 : : // if last reference then delete data
1273 [ + + ]: 294979 : if ( mpData->mnRefCount == 1 )
1274 [ + - ]: 32034 : delete mpData;
1275 : : else
1276 : 262945 : mpData->mnRefCount--;
1277 : 294979 : }
1278 : :
1279 : : // -----------------------------------------------------------------------
1280 : :
1281 : 196087 : const AllSettings& AllSettings::operator =( const AllSettings& rSet )
1282 : : {
1283 : : DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFFFFFE, "AllSettings: RefCount overflow" );
1284 : : DBG_CHKTHIS( AllSettings, NULL );
1285 : : DBG_CHKOBJ( &rSet, AllSettings, NULL );
1286 : :
1287 : : // increase reference counter first, to be able to assign oneself
1288 : 196087 : rSet.mpData->mnRefCount++;
1289 : :
1290 : : // if last reference then delete data
1291 [ + + ]: 196087 : if ( mpData->mnRefCount == 1 )
1292 [ + - ]: 6732 : delete mpData;
1293 : : else
1294 : 189355 : mpData->mnRefCount--;
1295 : :
1296 : 196087 : mpData = rSet.mpData;
1297 : :
1298 : 196087 : return *this;
1299 : : }
1300 : :
1301 : : // -----------------------------------------------------------------------
1302 : :
1303 : 41265 : void AllSettings::CopyData()
1304 : : {
1305 : : DBG_CHKTHIS( AllSettings, NULL );
1306 : :
1307 : : // copy if other references exist
1308 [ + + ]: 41265 : if ( mpData->mnRefCount != 1 )
1309 : : {
1310 : 38756 : mpData->mnRefCount--;
1311 [ + - ]: 38756 : mpData = new ImplAllSettingsData( *mpData );
1312 : : }
1313 : 41265 : }
1314 : :
1315 : : // -----------------------------------------------------------------------
1316 : :
1317 : 884 : sal_uLong AllSettings::Update( sal_uLong nFlags, const AllSettings& rSet )
1318 : : {
1319 : : DBG_CHKTHIS( AllSettings, NULL );
1320 : : DBG_CHKOBJ( &rSet, AllSettings, NULL );
1321 : :
1322 : 884 : sal_uLong nChangeFlags = 0;
1323 : :
1324 [ + - ]: 884 : if ( nFlags & SETTINGS_MOUSE )
1325 : : {
1326 [ + + ]: 884 : if ( mpData->maMouseSettings != rSet.mpData->maMouseSettings )
1327 : : {
1328 : 316 : CopyData();
1329 : 316 : mpData->maMouseSettings = rSet.mpData->maMouseSettings;
1330 : 316 : nChangeFlags |= SETTINGS_MOUSE;
1331 : : }
1332 : : }
1333 : :
1334 [ + - ]: 884 : if ( nFlags & SETTINGS_STYLE )
1335 : : {
1336 [ + + ]: 884 : if ( mpData->maStyleSettings != rSet.mpData->maStyleSettings )
1337 : : {
1338 : 316 : CopyData();
1339 : 316 : mpData->maStyleSettings = rSet.mpData->maStyleSettings;
1340 : 316 : nChangeFlags |= SETTINGS_STYLE;
1341 : : }
1342 : : }
1343 : :
1344 [ + - ]: 884 : if ( nFlags & SETTINGS_MISC )
1345 : : {
1346 [ - + ]: 884 : if ( mpData->maMiscSettings != rSet.mpData->maMiscSettings )
1347 : : {
1348 : 0 : CopyData();
1349 : 0 : mpData->maMiscSettings = rSet.mpData->maMiscSettings;
1350 : 0 : nChangeFlags |= SETTINGS_MISC;
1351 : : }
1352 : : }
1353 : :
1354 [ + - ]: 884 : if ( nFlags & SETTINGS_HELP )
1355 : : {
1356 [ + + ]: 884 : if ( mpData->maHelpSettings != rSet.mpData->maHelpSettings )
1357 : : {
1358 : 316 : CopyData();
1359 : 316 : mpData->maHelpSettings = rSet.mpData->maHelpSettings;
1360 : 316 : nChangeFlags |= SETTINGS_HELP;
1361 : : }
1362 : : }
1363 : :
1364 [ + - ]: 884 : if ( nFlags & SETTINGS_LOCALE )
1365 : : {
1366 [ + + ][ + + ]: 884 : if ( mpData->meLanguage || rSet.mpData->meLanguage )
1367 : : {
1368 : 246 : SetLanguage( rSet.mpData->meLanguage );
1369 : 246 : nChangeFlags |= SETTINGS_LOCALE;
1370 : : }
1371 : : }
1372 : :
1373 : 884 : if ( nFlags & SETTINGS_UILOCALE )
1374 : : {
1375 : : // UILocale can't be changed
1376 : : }
1377 : :
1378 : 884 : return nChangeFlags;
1379 : : }
1380 : :
1381 : : // -----------------------------------------------------------------------
1382 : :
1383 : 42099 : sal_uLong AllSettings::GetChangeFlags( const AllSettings& rSet ) const
1384 : : {
1385 : : DBG_CHKTHIS( AllSettings, NULL );
1386 : : DBG_CHKOBJ( &rSet, AllSettings, NULL );
1387 : :
1388 : 42099 : sal_uLong nChangeFlags = 0;
1389 : :
1390 [ + + ]: 42099 : if ( mpData->maMouseSettings != rSet.mpData->maMouseSettings )
1391 : 2590 : nChangeFlags |= SETTINGS_MOUSE;
1392 : :
1393 [ + + ]: 42099 : if ( mpData->maStyleSettings != rSet.mpData->maStyleSettings )
1394 : 346 : nChangeFlags |= SETTINGS_STYLE;
1395 : :
1396 [ - + ]: 42099 : if ( mpData->maMiscSettings != rSet.mpData->maMiscSettings )
1397 : 0 : nChangeFlags |= SETTINGS_MISC;
1398 : :
1399 [ + + ]: 42099 : if ( mpData->maHelpSettings != rSet.mpData->maHelpSettings )
1400 : 158 : nChangeFlags |= SETTINGS_HELP;
1401 : :
1402 [ + + ][ + + ]: 42099 : if ( mpData->meLanguage || rSet.mpData->meLanguage )
1403 : 54 : nChangeFlags |= SETTINGS_LOCALE;
1404 : :
1405 : 42099 : return nChangeFlags;
1406 : : }
1407 : :
1408 : : // -----------------------------------------------------------------------
1409 : :
1410 : 0 : sal_Bool AllSettings::operator ==( const AllSettings& rSet ) const
1411 : : {
1412 : : DBG_CHKTHIS( AllSettings, NULL );
1413 : : DBG_CHKOBJ( &rSet, AllSettings, NULL );
1414 : :
1415 [ # # ]: 0 : if ( mpData == rSet.mpData )
1416 : 0 : return sal_True;
1417 : :
1418 [ # # # # : 0 : if ( (mpData->maMouseSettings == rSet.mpData->maMouseSettings) &&
# # # # ]
[ # # # # ]
[ # # ][ # # ]
1419 : 0 : (mpData->maStyleSettings == rSet.mpData->maStyleSettings) &&
1420 : 0 : (mpData->maMiscSettings == rSet.mpData->maMiscSettings) &&
1421 : 0 : (mpData->maHelpSettings == rSet.mpData->maHelpSettings) &&
1422 : : (mpData->mnSystemUpdate == rSet.mpData->mnSystemUpdate) &&
1423 : 0 : (mpData->maLocale == rSet.mpData->maLocale) &&
1424 : : (mpData->mnWindowUpdate == rSet.mpData->mnWindowUpdate) )
1425 : : {
1426 : 0 : return sal_True;
1427 : : }
1428 : : else
1429 : 0 : return sal_False;
1430 : : }
1431 : :
1432 : : // -----------------------------------------------------------------------
1433 : :
1434 : 6 : void AllSettings::SetLocale( const ::com::sun::star::lang::Locale& rLocale )
1435 : : {
1436 : 6 : CopyData();
1437 : :
1438 : 6 : mpData->maLocale = rLocale;
1439 : :
1440 [ - + ]: 6 : if ( rLocale.Language.isEmpty() )
1441 : 0 : mpData->meLanguage = LANGUAGE_SYSTEM;
1442 : : else
1443 : 6 : mpData->meLanguage = MsLangId::convertLocaleToLanguage( rLocale );
1444 [ - + ]: 6 : if ( mpData->mpLocaleDataWrapper )
1445 : : {
1446 [ # # ]: 0 : delete mpData->mpLocaleDataWrapper;
1447 : 0 : mpData->mpLocaleDataWrapper = NULL;
1448 : : }
1449 [ - + ]: 6 : if ( mpData->mpI18nHelper )
1450 : : {
1451 [ # # ]: 0 : delete mpData->mpI18nHelper;
1452 : 0 : mpData->mpI18nHelper = NULL;
1453 : : }
1454 : 6 : }
1455 : :
1456 : : // -----------------------------------------------------------------------
1457 : :
1458 : 0 : void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& )
1459 : : {
1460 : : // there is only one UILocale per process
1461 : 0 : }
1462 : :
1463 : : // -----------------------------------------------------------------------
1464 : :
1465 : 246 : void AllSettings::SetLanguage( LanguageType eLang )
1466 : : {
1467 [ + - ]: 246 : if ( eLang != mpData->meLanguage )
1468 : : {
1469 : 246 : CopyData();
1470 : :
1471 : 246 : mpData->meLanguage = eLang;
1472 : 246 : MsLangId::convertLanguageToLocale( GetLanguage(), ((AllSettings*)this)->mpData->maLocale );
1473 [ - + ]: 246 : if ( mpData->mpLocaleDataWrapper )
1474 : : {
1475 [ # # ]: 0 : delete mpData->mpLocaleDataWrapper;
1476 : 0 : mpData->mpLocaleDataWrapper = NULL;
1477 : : }
1478 [ - + ]: 246 : if ( mpData->mpI18nHelper )
1479 : : {
1480 [ # # ]: 0 : delete mpData->mpI18nHelper;
1481 : 0 : mpData->mpI18nHelper = NULL;
1482 : : }
1483 : : }
1484 : 246 : }
1485 : :
1486 : : // -----------------------------------------------------------------------
1487 : :
1488 : 0 : void AllSettings::SetUILanguage( LanguageType )
1489 : : {
1490 : : // there is only one UILanguage per process
1491 : 0 : }
1492 : :
1493 : : // -----------------------------------------------------------------------
1494 : :
1495 : 589359 : bool AllSettings::GetLayoutRTL() const
1496 : : {
1497 [ + + ][ + - ]: 589359 : static const char* pEnv = getenv("SAL_RTL_ENABLED" );
1498 : : static int nUIMirroring = -1; // -1: undef, 0: auto, 1: on 2: off
1499 : :
1500 : : // environment always overrides
1501 [ - + ]: 589359 : if( pEnv )
1502 : 0 : return true;
1503 : :
1504 : 589359 : bool bRTL = false;
1505 : :
1506 [ + + ]: 589359 : if( nUIMirroring == -1 )
1507 : : {
1508 : 245 : nUIMirroring = 0; // ask configuration only once
1509 : : utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
1510 : : vcl::unohelper::GetMultiServiceFactory(),
1511 [ + - ][ + - ]: 245 : OUString("org.openoffice.Office.Common/I18N/CTL") ); // note: case sensitive !
[ + - ][ + - ]
1512 [ + - ]: 245 : if ( aNode.isValid() )
1513 : : {
1514 : 245 : sal_Bool bTmp = sal_Bool();
1515 : 245 : ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString("UIMirroring") );
1516 [ - + ]: 245 : if( aValue >>= bTmp )
1517 : : {
1518 : : // found true or false; if it was nil, nothing is changed
1519 [ # # ]: 0 : nUIMirroring = bTmp ? 1 : 2;
1520 : 245 : }
1521 [ + - ]: 245 : }
1522 : : }
1523 : :
1524 [ + - ]: 589359 : if( nUIMirroring == 0 ) // no config found (eg, setup) or default (nil) was set: check language
1525 : : {
1526 : 589359 : LanguageType aLang = LANGUAGE_DONTKNOW;
1527 : 589359 : ImplSVData* pSVData = ImplGetSVData();
1528 [ + - ]: 589359 : if ( pSVData->maAppData.mpSettings )
1529 : 589359 : aLang = pSVData->maAppData.mpSettings->GetUILanguage();
1530 : 589359 : bRTL = MsLangId::isRightToLeft( aLang );
1531 : : }
1532 : : else
1533 : 0 : bRTL = (nUIMirroring == 1);
1534 : :
1535 : 589359 : return bRTL;
1536 : : }
1537 : :
1538 : : // -----------------------------------------------------------------------
1539 : :
1540 : 15079 : const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const
1541 : : {
1542 [ + + ]: 15079 : if ( mpData->maLocale.Language.isEmpty() )
1543 : 99 : mpData->maLocale = mpData->maSysLocale.GetLocale();
1544 : :
1545 : 15079 : return mpData->maLocale;
1546 : : }
1547 : :
1548 : : // -----------------------------------------------------------------------
1549 : :
1550 : 53816 : const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const
1551 : : {
1552 : : // the UILocale is never changed
1553 [ + + ]: 53816 : if ( mpData->maUILocale.Language.isEmpty() )
1554 : 1006 : mpData->maUILocale = mpData->maSysLocale.GetUILocale();
1555 : :
1556 : 53816 : return mpData->maUILocale;
1557 : : }
1558 : :
1559 : : // -----------------------------------------------------------------------
1560 : :
1561 : 1904214 : LanguageType AllSettings::GetLanguage() const
1562 : : {
1563 : : // meLanguage == LANGUAGE_SYSTEM means: use settings from SvtSysLocale
1564 [ + + ]: 1904214 : if ( mpData->meLanguage == LANGUAGE_SYSTEM )
1565 : 1904166 : return mpData->maSysLocale.GetLanguage();
1566 : :
1567 : 1904214 : return mpData->meLanguage;
1568 : : }
1569 : :
1570 : : // -----------------------------------------------------------------------
1571 : :
1572 : 602621 : LanguageType AllSettings::GetUILanguage() const
1573 : : {
1574 : : // the UILanguage is never changed
1575 : 602621 : return mpData->maSysLocale.GetUILanguage();
1576 : : }
1577 : :
1578 : : // -----------------------------------------------------------------------
1579 : :
1580 : 3597 : const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const
1581 : : {
1582 [ + + ]: 3597 : if ( !mpData->mpLocaleDataWrapper )
1583 [ + - ][ + - ]: 20 : ((AllSettings*)this)->mpData->mpLocaleDataWrapper = new LocaleDataWrapper( vcl::unohelper::GetMultiServiceFactory(), GetLocale() );
[ + - ]
1584 : 3597 : return *mpData->mpLocaleDataWrapper;
1585 : : }
1586 : :
1587 : : // -----------------------------------------------------------------------
1588 : :
1589 : 0 : const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const
1590 : : {
1591 [ # # ]: 0 : if ( !mpData->mpUILocaleDataWrapper )
1592 [ # # ][ # # ]: 0 : ((AllSettings*)this)->mpData->mpUILocaleDataWrapper = new LocaleDataWrapper( vcl::unohelper::GetMultiServiceFactory(), GetUILocale() );
[ # # ]
1593 : 0 : return *mpData->mpUILocaleDataWrapper;
1594 : : }
1595 : :
1596 : : // -----------------------------------------------------------------------
1597 : :
1598 : 9852 : const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
1599 : : {
1600 [ + + ]: 9852 : if ( !mpData->mpI18nHelper ) {
1601 [ + - ]: 122 : ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> aFactory(vcl::unohelper::GetMultiServiceFactory());
1602 [ + - ][ + - ]: 122 : ((AllSettings*)this)->mpData->mpI18nHelper = new vcl::I18nHelper( aFactory, GetLocale() );
[ + - ]
1603 : : }
1604 : 9852 : return *mpData->mpI18nHelper;
1605 : : }
1606 : :
1607 : : // -----------------------------------------------------------------------
1608 : :
1609 : 0 : const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
1610 : : {
1611 [ # # ]: 0 : if ( !mpData->mpUII18nHelper ) {
1612 [ # # ]: 0 : ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> aFactory(vcl::unohelper::GetMultiServiceFactory());
1613 [ # # ][ # # ]: 0 : ((AllSettings*)this)->mpData->mpUII18nHelper = new vcl::I18nHelper( aFactory, GetUILocale() );
[ # # ]
1614 : : }
1615 : 0 : return *mpData->mpUII18nHelper;
1616 : : }
1617 : :
1618 : 0 : void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint )
1619 : : {
1620 [ # # ][ # # ]: 0 : AllSettings aAllSettings( Application::GetSettings() );
1621 [ # # ]: 0 : if ( nHint & SYSLOCALEOPTIONS_HINT_DECSEP )
1622 : : {
1623 [ # # ]: 0 : MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
1624 [ # # ][ # # ]: 0 : sal_Bool bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale();
1625 [ # # ][ # # ]: 0 : if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale )
1626 : : {
1627 [ # # ]: 0 : aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale );
1628 [ # # ]: 0 : aAllSettings.SetMiscSettings( aMiscSettings );
1629 [ # # ]: 0 : }
1630 : : }
1631 : :
1632 [ # # ]: 0 : if ( (nHint & SYSLOCALEOPTIONS_HINT_LOCALE) )
1633 [ # # ][ # # ]: 0 : aAllSettings.SetLocale( aAllSettings.mpData->maSysLocale.GetOptions().GetLocale() );
[ # # ]
1634 : :
1635 [ # # ][ # # ]: 0 : Application::SetSettings( aAllSettings );
1636 : 0 : }
1637 : :
1638 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|