1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: settings.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
33 #include "tools/debug.hxx"
34 #include "i18npool/mslangid.hxx"
35 #include "vcl/svapp.hxx"
36 #include "vcl/svdata.hxx"
37 #include "vcl/event.hxx"
38 #include "vcl/settings.hxx"
39 #include "vcl/i18nhelp.hxx"
40 #include "vcl/fontcfg.hxx"
41 #include "vcl/configsettings.hxx"
42 #include "vcl/gradient.hxx"
43 #include "vcl/unohelp.hxx"
44 #include "vcl/bitmapex.hxx"
45 #include "vcl/impimagetree.hxx"
46 #include "unotools/localedatawrapper.hxx"
47 #include "unotools/collatorwrapper.hxx"
48 #include "unotools/configmgr.hxx"
49 #include "unotools/confignode.hxx"
52 #include "tools/prewin.h"
54 #include "tools/postwin.h"
59 // =======================================================================
61 DBG_NAME( AllSettings
)
63 // =======================================================================
65 #define STDSYS_STYLE (STYLE_OPTION_SCROLLARROW | \
66 STYLE_OPTION_SPINARROW | \
67 STYLE_OPTION_SPINUPDOWN | \
68 STYLE_OPTION_NOMNEMONICS)
70 // =======================================================================
72 ImplMachineData::ImplMachineData()
78 mnScreenRasterFontDeviation
= 0;
81 // -----------------------------------------------------------------------
83 ImplMachineData::ImplMachineData( const ImplMachineData
& rData
)
86 mnOptions
= rData
.mnOptions
;
87 mnScreenOptions
= rData
.mnScreenOptions
;
88 mnPrintOptions
= rData
.mnPrintOptions
;
89 mnScreenRasterFontDeviation
= rData
.mnScreenRasterFontDeviation
;
92 // -----------------------------------------------------------------------
94 MachineSettings::MachineSettings()
96 mpData
= new ImplMachineData();
99 // -----------------------------------------------------------------------
101 MachineSettings::MachineSettings( const MachineSettings
& rSet
)
103 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "MachineSettings: RefCount overflow" );
105 // shared Instance Daten uebernehmen und Referenzcounter erhoehen
106 mpData
= rSet
.mpData
;
107 mpData
->mnRefCount
++;
110 // -----------------------------------------------------------------------
112 MachineSettings::~MachineSettings()
114 // Daten loeschen, wenn letzte Referenz
115 if ( mpData
->mnRefCount
== 1 )
118 mpData
->mnRefCount
--;
121 // -----------------------------------------------------------------------
123 const MachineSettings
& MachineSettings::operator =( const MachineSettings
& rSet
)
125 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "MachineSettings: RefCount overflow" );
127 // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
128 rSet
.mpData
->mnRefCount
++;
130 // Daten loeschen, wenn letzte Referenz
131 if ( mpData
->mnRefCount
== 1 )
134 mpData
->mnRefCount
--;
136 mpData
= rSet
.mpData
;
141 // -----------------------------------------------------------------------
143 void MachineSettings::CopyData()
145 // Falls noch andere Referenzen bestehen, dann kopieren
146 if ( mpData
->mnRefCount
!= 1 )
148 mpData
->mnRefCount
--;
149 mpData
= new ImplMachineData( *mpData
);
153 // -----------------------------------------------------------------------
155 BOOL
MachineSettings::operator ==( const MachineSettings
& rSet
) const
157 if ( mpData
== rSet
.mpData
)
160 if ( (mpData
->mnOptions
== rSet
.mpData
->mnOptions
) &&
161 (mpData
->mnScreenOptions
== rSet
.mpData
->mnScreenOptions
) &&
162 (mpData
->mnPrintOptions
== rSet
.mpData
->mnPrintOptions
) &&
163 (mpData
->mnScreenRasterFontDeviation
== rSet
.mpData
->mnScreenRasterFontDeviation
) )
169 // =======================================================================
171 ImplMouseData::ImplMouseData()
175 mnDoubleClkTime
= 500;
176 mnDoubleClkWidth
= 2;
177 mnDoubleClkHeight
= 2;
178 mnStartDragWidth
= 2;
179 mnStartDragHeight
= 2;
180 mnStartDragCode
= MOUSE_LEFT
;
182 mnDragCopyCode
= KEY_MOD1
;
183 mnDragLinkCode
= KEY_SHIFT
| KEY_MOD1
;
184 mnContextMenuCode
= MOUSE_RIGHT
;
185 mnContextMenuClicks
= 1;
186 mbContextMenuDown
= TRUE
;
187 mnMiddleButtonAction
= MOUSE_MIDDLE_AUTOSCROLL
;
188 mnScrollRepeat
= 100;
189 mnButtonStartRepeat
= 370;
193 mnFollow
= MOUSE_FOLLOW_MENU
| MOUSE_FOLLOW_DDLIST
;
194 mnWheelBehavior
= MOUSE_WHEEL_FOCUS_ONLY
;
197 // -----------------------------------------------------------------------
199 ImplMouseData::ImplMouseData( const ImplMouseData
& rData
)
202 mnOptions
= rData
.mnOptions
;
203 mnDoubleClkTime
= rData
.mnDoubleClkTime
;
204 mnDoubleClkWidth
= rData
.mnDoubleClkWidth
;
205 mnDoubleClkHeight
= rData
.mnDoubleClkHeight
;
206 mnStartDragWidth
= rData
.mnStartDragWidth
;
207 mnStartDragHeight
= rData
.mnStartDragHeight
;
208 mnStartDragCode
= rData
.mnStartDragCode
;
209 mnDragMoveCode
= rData
.mnDragMoveCode
;
210 mnDragCopyCode
= rData
.mnDragCopyCode
;
211 mnDragLinkCode
= rData
.mnDragLinkCode
;
212 mnContextMenuCode
= rData
.mnContextMenuCode
;
213 mnContextMenuClicks
= rData
.mnContextMenuClicks
;
214 mbContextMenuDown
= rData
.mbContextMenuDown
;
215 mnMiddleButtonAction
= rData
.mnMiddleButtonAction
;
216 mnScrollRepeat
= rData
.mnScrollRepeat
;
217 mnButtonStartRepeat
= rData
.mnButtonStartRepeat
;
218 mnButtonRepeat
= rData
.mnButtonRepeat
;
219 mnActionDelay
= rData
.mnActionDelay
;
220 mnMenuDelay
= rData
.mnMenuDelay
;
221 mnFollow
= rData
.mnFollow
;
222 mnWheelBehavior
= rData
.mnWheelBehavior
;
225 // -----------------------------------------------------------------------
227 MouseSettings::MouseSettings()
229 mpData
= new ImplMouseData();
232 // -----------------------------------------------------------------------
234 MouseSettings::MouseSettings( const MouseSettings
& rSet
)
236 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "MouseSettings: RefCount overflow" );
238 // shared Instance Daten uebernehmen und Referenzcounter erhoehen
239 mpData
= rSet
.mpData
;
240 mpData
->mnRefCount
++;
243 // -----------------------------------------------------------------------
245 MouseSettings::~MouseSettings()
247 // Daten loeschen, wenn letzte Referenz
248 if ( mpData
->mnRefCount
== 1 )
251 mpData
->mnRefCount
--;
254 // -----------------------------------------------------------------------
256 const MouseSettings
& MouseSettings::operator =( const MouseSettings
& rSet
)
258 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "MouseSettings: RefCount overflow" );
260 // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
261 rSet
.mpData
->mnRefCount
++;
263 // Daten loeschen, wenn letzte Referenz
264 if ( mpData
->mnRefCount
== 1 )
267 mpData
->mnRefCount
--;
269 mpData
= rSet
.mpData
;
274 // -----------------------------------------------------------------------
276 void MouseSettings::CopyData()
278 // Falls noch andere Referenzen bestehen, dann kopieren
279 if ( mpData
->mnRefCount
!= 1 )
281 mpData
->mnRefCount
--;
282 mpData
= new ImplMouseData( *mpData
);
286 // -----------------------------------------------------------------------
288 BOOL
MouseSettings::operator ==( const MouseSettings
& rSet
) const
290 if ( mpData
== rSet
.mpData
)
293 if ( (mpData
->mnOptions
== rSet
.mpData
->mnOptions
) &&
294 (mpData
->mnDoubleClkTime
== rSet
.mpData
->mnDoubleClkTime
) &&
295 (mpData
->mnDoubleClkWidth
== rSet
.mpData
->mnDoubleClkWidth
) &&
296 (mpData
->mnDoubleClkHeight
== rSet
.mpData
->mnDoubleClkHeight
) &&
297 (mpData
->mnStartDragWidth
== rSet
.mpData
->mnStartDragWidth
) &&
298 (mpData
->mnStartDragHeight
== rSet
.mpData
->mnStartDragHeight
) &&
299 (mpData
->mnStartDragCode
== rSet
.mpData
->mnStartDragCode
) &&
300 (mpData
->mnDragMoveCode
== rSet
.mpData
->mnDragMoveCode
) &&
301 (mpData
->mnDragCopyCode
== rSet
.mpData
->mnDragCopyCode
) &&
302 (mpData
->mnDragLinkCode
== rSet
.mpData
->mnDragLinkCode
) &&
303 (mpData
->mnContextMenuCode
== rSet
.mpData
->mnContextMenuCode
) &&
304 (mpData
->mnContextMenuClicks
== rSet
.mpData
->mnContextMenuClicks
) &&
305 (mpData
->mbContextMenuDown
== rSet
.mpData
->mbContextMenuDown
) &&
306 (mpData
->mnMiddleButtonAction
== rSet
.mpData
->mnMiddleButtonAction
) &&
307 (mpData
->mnScrollRepeat
== rSet
.mpData
->mnScrollRepeat
) &&
308 (mpData
->mnButtonStartRepeat
== rSet
.mpData
->mnButtonStartRepeat
) &&
309 (mpData
->mnButtonRepeat
== rSet
.mpData
->mnButtonRepeat
) &&
310 (mpData
->mnActionDelay
== rSet
.mpData
->mnActionDelay
) &&
311 (mpData
->mnMenuDelay
== rSet
.mpData
->mnMenuDelay
) &&
312 (mpData
->mnFollow
== rSet
.mpData
->mnFollow
) &&
313 (mpData
->mnWheelBehavior
== rSet
.mpData
->mnWheelBehavior
) )
319 // =======================================================================
321 ImplKeyboardData::ImplKeyboardData()
327 // -----------------------------------------------------------------------
329 ImplKeyboardData::ImplKeyboardData( const ImplKeyboardData
& rData
)
332 mnOptions
= rData
.mnOptions
;
335 // -----------------------------------------------------------------------
337 KeyboardSettings::KeyboardSettings()
339 mpData
= new ImplKeyboardData();
342 // -----------------------------------------------------------------------
344 KeyboardSettings::KeyboardSettings( const KeyboardSettings
& rSet
)
346 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "KeyboardSettings: RefCount overflow" );
348 // shared Instance Daten uebernehmen und Referenzcounter erhoehen
349 mpData
= rSet
.mpData
;
350 mpData
->mnRefCount
++;
353 // -----------------------------------------------------------------------
355 KeyboardSettings::~KeyboardSettings()
357 // Daten loeschen, wenn letzte Referenz
358 if ( mpData
->mnRefCount
== 1 )
361 mpData
->mnRefCount
--;
364 // -----------------------------------------------------------------------
366 const KeyboardSettings
& KeyboardSettings::operator =( const KeyboardSettings
& rSet
)
368 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "KeyboardSettings: RefCount overflow" );
370 // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
371 rSet
.mpData
->mnRefCount
++;
373 // Daten loeschen, wenn letzte Referenz
374 if ( mpData
->mnRefCount
== 1 )
377 mpData
->mnRefCount
--;
379 mpData
= rSet
.mpData
;
384 // -----------------------------------------------------------------------
386 void KeyboardSettings::CopyData()
388 // Falls noch andere Referenzen bestehen, dann kopieren
389 if ( mpData
->mnRefCount
!= 1 )
391 mpData
->mnRefCount
--;
392 mpData
= new ImplKeyboardData( *mpData
);
396 // -----------------------------------------------------------------------
398 BOOL
KeyboardSettings::operator ==( const KeyboardSettings
& rSet
) const
400 if ( mpData
== rSet
.mpData
)
403 if ( (mpData
->mnOptions
== rSet
.mpData
->mnOptions
) )
409 // =======================================================================
411 ImplStyleData::ImplStyleData()
414 mnScrollBarSize
= 16;
418 mnIconHorzSpace
= 50;
419 mnIconVertSpace
= 40;
420 mnAntialiasedMin
= 0;
422 mnCursorBlinkTime
= STYLE_CURSOR_NOBLINKTIME
;
424 mnScreenFontZoom
= 100;
425 mnRadioButtonStyle
= 0;
427 mnPushButtonStyle
= 0;
428 mnTabControlStyle
= 0;
429 mnLogoDisplayTime
= LOGO_DISPLAYTIME_STARTTIME
;
430 mnDragFullOptions
= 0;
431 mnAnimationOptions
= 0;
432 mnSelectionOptions
= 0;
433 mnDisplayOptions
= 0;
436 mnToolbarIconSize
= STYLE_TOOLBAR_ICONSIZE_UNKNOWN
;
437 mnSymbolsStyle
= STYLE_SYMBOLS_AUTO
;
438 mnPreferredSymbolsStyle
= STYLE_SYMBOLS_AUTO
;
443 // -----------------------------------------------------------------------
445 ImplStyleData::ImplStyleData( const ImplStyleData
& rData
) :
446 maActiveBorderColor( rData
.maActiveBorderColor
),
447 maActiveColor( rData
.maActiveColor
),
448 maActiveColor2( rData
.maActiveColor2
),
449 maActiveTextColor( rData
.maActiveTextColor
),
450 maButtonTextColor( rData
.maButtonTextColor
),
451 maButtonRolloverTextColor( rData
.maButtonRolloverTextColor
),
452 maCheckedColor( rData
.maCheckedColor
),
453 maDarkShadowColor( rData
.maDarkShadowColor
),
454 maDeactiveBorderColor( rData
.maDeactiveBorderColor
),
455 maDeactiveColor( rData
.maDeactiveColor
),
456 maDeactiveColor2( rData
.maDeactiveColor2
),
457 maDeactiveTextColor( rData
.maDeactiveTextColor
),
458 maDialogColor( rData
.maDialogColor
),
459 maDialogTextColor( rData
.maDialogTextColor
),
460 maDisableColor( rData
.maDisableColor
),
461 maFaceColor( rData
.maFaceColor
),
462 maFieldColor( rData
.maFieldColor
),
463 maFieldTextColor( rData
.maFieldTextColor
),
464 maFieldRolloverTextColor( rData
.maFieldRolloverTextColor
),
465 maFontColor( rData
.maFontColor
),
466 maGroupTextColor( rData
.maGroupTextColor
),
467 maHelpColor( rData
.maHelpColor
),
468 maHelpTextColor( rData
.maHelpTextColor
),
469 maHighlightColor( rData
.maHighlightColor
),
470 maHighlightLinkColor( rData
.maHighlightLinkColor
),
471 maHighlightTextColor( rData
.maHighlightTextColor
),
472 maInfoTextColor( rData
.maInfoTextColor
),
473 maLabelTextColor( rData
.maLabelTextColor
),
474 maLightBorderColor( rData
.maLightBorderColor
),
475 maLightColor( rData
.maLightColor
),
476 maLinkColor( rData
.maLinkColor
),
477 maMenuBarColor( rData
.maMenuBarColor
),
478 maMenuBorderColor( rData
.maMenuBorderColor
),
479 maMenuColor( rData
.maMenuColor
),
480 maMenuHighlightColor( rData
.maMenuHighlightColor
),
481 maMenuHighlightTextColor( rData
.maMenuHighlightTextColor
),
482 maMenuTextColor( rData
.maMenuTextColor
),
483 maMenuBarTextColor( rData
.maMenuBarTextColor
),
484 maMonoColor( rData
.maMonoColor
),
485 maRadioCheckTextColor( rData
.maRadioCheckTextColor
),
486 maShadowColor( rData
.maShadowColor
),
487 maVisitedLinkColor( rData
.maVisitedLinkColor
),
488 maWindowColor( rData
.maWindowColor
),
489 maWindowTextColor( rData
.maWindowTextColor
),
490 maWorkspaceColor( rData
.maWorkspaceColor
),
491 maActiveTabColor( rData
.maActiveTabColor
),
492 maInactiveTabColor( rData
.maInactiveTabColor
),
493 maAppFont( rData
.maAppFont
),
494 maHelpFont( rData
.maAppFont
),
495 maTitleFont( rData
.maTitleFont
),
496 maFloatTitleFont( rData
.maFloatTitleFont
),
497 maMenuFont( rData
.maMenuFont
),
498 maToolFont( rData
.maToolFont
),
499 maLabelFont( rData
.maLabelFont
),
500 maInfoFont( rData
.maInfoFont
),
501 maRadioCheckFont( rData
.maRadioCheckFont
),
502 maPushButtonFont( rData
.maPushButtonFont
),
503 maFieldFont( rData
.maFieldFont
),
504 maIconFont( rData
.maIconFont
),
505 maGroupFont( rData
.maGroupFont
),
506 maWorkspaceGradient( rData
.maWorkspaceGradient
)
509 mnBorderSize
= rData
.mnBorderSize
;
510 mnTitleHeight
= rData
.mnTitleHeight
;
511 mnFloatTitleHeight
= rData
.mnFloatTitleHeight
;
512 mnTearOffTitleHeight
= rData
.mnTearOffTitleHeight
;
513 mnMenuBarHeight
= rData
.mnMenuBarHeight
;
514 mnScrollBarSize
= rData
.mnScrollBarSize
;
515 mnMinThumbSize
= rData
.mnMinThumbSize
;
516 mnSplitSize
= rData
.mnSplitSize
;
517 mnSpinSize
= rData
.mnSpinSize
;
518 mnIconHorzSpace
= rData
.mnIconHorzSpace
;
519 mnIconVertSpace
= rData
.mnIconVertSpace
;
520 mnAntialiasedMin
= rData
.mnAntialiasedMin
;
521 mnCursorSize
= rData
.mnCursorSize
;
522 mnCursorBlinkTime
= rData
.mnCursorBlinkTime
;
523 mnScreenZoom
= rData
.mnScreenZoom
;
524 mnScreenFontZoom
= rData
.mnScreenFontZoom
;
525 mnRadioButtonStyle
= rData
.mnRadioButtonStyle
;
526 mnCheckBoxStyle
= rData
.mnCheckBoxStyle
;
527 mnPushButtonStyle
= rData
.mnPushButtonStyle
;
528 mnTabControlStyle
= rData
.mnTabControlStyle
;
529 mnLogoDisplayTime
= rData
.mnLogoDisplayTime
;
530 mnDragFullOptions
= rData
.mnDragFullOptions
;
531 mnAnimationOptions
= rData
.mnAnimationOptions
;
532 mnSelectionOptions
= rData
.mnSelectionOptions
;
533 mnDisplayOptions
= rData
.mnDisplayOptions
;
534 mnOptions
= rData
.mnOptions
;
535 mnHighContrast
= rData
.mnHighContrast
;
536 mnUseSystemUIFonts
= rData
.mnUseSystemUIFonts
;
537 mnUseFlatBorders
= rData
.mnUseFlatBorders
;
538 mnUseFlatMenues
= rData
.mnUseFlatMenues
;
539 mnAutoMnemonic
= rData
.mnAutoMnemonic
;
540 mnUseImagesInMenus
= rData
.mnUseImagesInMenus
;
541 mnSkipDisabledInMenus
= rData
.mnSkipDisabledInMenus
;
542 mnToolbarIconSize
= rData
.mnToolbarIconSize
;
543 mnSymbolsStyle
= rData
.mnSymbolsStyle
;
544 mnPreferredSymbolsStyle
= rData
.mnPreferredSymbolsStyle
;
547 // -----------------------------------------------------------------------
549 void ImplStyleData::SetStandardStyles()
551 Font
aStdFont( FAMILY_SWISS
, Size( 0, 10 ) );
552 aStdFont
.SetCharSet( gsl_getSystemTextEncoding() );
553 aStdFont
.SetWeight( WEIGHT_NORMAL
);
554 aStdFont
.SetName( vcl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) );
555 maAppFont
= aStdFont
;
556 maHelpFont
= aStdFont
;
557 maMenuFont
= aStdFont
;
558 maToolFont
= aStdFont
;
559 maGroupFont
= aStdFont
;
560 maLabelFont
= aStdFont
;
561 maInfoFont
= aStdFont
;
562 maRadioCheckFont
= aStdFont
;
563 maPushButtonFont
= aStdFont
;
564 maFieldFont
= aStdFont
;
565 maIconFont
= aStdFont
;
566 maFloatTitleFont
= aStdFont
;
567 aStdFont
.SetWeight( WEIGHT_BOLD
);
568 maTitleFont
= aStdFont
;
570 maFaceColor
= Color( COL_LIGHTGRAY
);
571 maCheckedColor
= Color( 0xCC, 0xCC, 0xCC );
572 maLightColor
= Color( COL_WHITE
);
573 maLightBorderColor
= Color( COL_LIGHTGRAY
);
574 maShadowColor
= Color( COL_GRAY
);
575 maDarkShadowColor
= Color( COL_BLACK
);
576 maButtonTextColor
= Color( COL_BLACK
);
577 maButtonRolloverTextColor
= Color( COL_BLACK
);
578 maRadioCheckTextColor
= Color( COL_BLACK
);
579 maGroupTextColor
= Color( COL_BLACK
);
580 maLabelTextColor
= Color( COL_BLACK
);
581 maInfoTextColor
= Color( COL_BLACK
);
582 maWindowColor
= Color( COL_WHITE
);
583 maWindowTextColor
= Color( COL_BLACK
);
584 maDialogColor
= Color( COL_LIGHTGRAY
);
585 maDialogTextColor
= Color( COL_BLACK
);
586 maWorkspaceColor
= Color( COL_GRAY
);
587 maMonoColor
= Color( COL_BLACK
);
588 maFieldColor
= Color( COL_WHITE
);
589 maFieldTextColor
= Color( COL_BLACK
);
590 maFieldRolloverTextColor
= Color( COL_BLACK
);
591 maActiveColor
= Color( COL_BLUE
);
592 maActiveColor2
= Color( COL_BLACK
);
593 maActiveTextColor
= Color( COL_WHITE
);
594 maActiveBorderColor
= Color( COL_LIGHTGRAY
);
595 maDeactiveColor
= Color( COL_GRAY
);
596 maDeactiveColor2
= Color( COL_BLACK
);
597 maDeactiveTextColor
= Color( COL_LIGHTGRAY
);
598 maDeactiveBorderColor
= Color( COL_LIGHTGRAY
);
599 maMenuColor
= Color( COL_LIGHTGRAY
);
600 maMenuBarColor
= Color( COL_LIGHTGRAY
);
601 maMenuBorderColor
= Color( COL_LIGHTGRAY
);
602 maMenuTextColor
= Color( COL_BLACK
);
603 maMenuBarTextColor
= Color( COL_BLACK
);
604 maMenuHighlightColor
= Color( COL_BLUE
);
605 maMenuHighlightTextColor
= Color( COL_WHITE
);
606 maHighlightColor
= Color( COL_BLUE
);
607 maHighlightTextColor
= Color( COL_WHITE
);
608 maActiveTabColor
= Color( COL_WHITE
);
609 maInactiveTabColor
= Color( COL_LIGHTGRAY
);
610 maDisableColor
= Color( COL_GRAY
);
611 maHelpColor
= Color( 0xFF, 0xFF, 0xE0 );
612 maHelpTextColor
= Color( COL_BLACK
);
613 maLinkColor
= Color( COL_BLUE
);
614 maVisitedLinkColor
= Color( 0x00, 0x00, 0xCC );
615 maHighlightLinkColor
= Color( COL_LIGHTBLUE
);
616 maFontColor
= Color( COL_BLACK
);
618 mnRadioButtonStyle
&= ~STYLE_RADIOBUTTON_STYLE
;
619 mnCheckBoxStyle
&= ~STYLE_CHECKBOX_STYLE
;
620 mnPushButtonStyle
&= ~STYLE_PUSHBUTTON_STYLE
;
621 mnTabControlStyle
= 0;
623 mnOptions
&= ~(STYLE_OPTION_SYSTEMSTYLE
| STDSYS_STYLE
);
626 mnFloatTitleHeight
= 13;
627 mnTearOffTitleHeight
= 8;
628 mnMenuBarHeight
= 14;
630 mnUseSystemUIFonts
= 1;
631 mnUseFlatBorders
= 0;
633 mnUseImagesInMenus
= (USHORT
)TRUE
;
634 mnSkipDisabledInMenus
= (USHORT
)FALSE
;
636 Gradient
aGrad( GRADIENT_LINEAR
, DEFAULT_WORKSPACE_GRADIENT_START_COLOR
, DEFAULT_WORKSPACE_GRADIENT_END_COLOR
);
637 maWorkspaceGradient
= Wallpaper( aGrad
);
640 // -----------------------------------------------------------------------
642 StyleSettings::StyleSettings()
644 mpData
= new ImplStyleData();
647 // -----------------------------------------------------------------------
649 StyleSettings::StyleSettings( const StyleSettings
& rSet
)
651 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "StyleSettings: RefCount overflow" );
653 // shared Instance Daten uebernehmen und Referenzcounter erhoehen
654 mpData
= rSet
.mpData
;
655 mpData
->mnRefCount
++;
658 // -----------------------------------------------------------------------
660 StyleSettings::~StyleSettings()
662 // Daten loeschen, wenn letzte Referenz
663 if ( mpData
->mnRefCount
== 1 )
666 mpData
->mnRefCount
--;
669 // -----------------------------------------------------------------------
671 void StyleSettings::Set3DColors( const Color
& rColor
)
674 mpData
->maFaceColor
= rColor
;
675 mpData
->maLightBorderColor
= rColor
;
676 mpData
->maMenuBorderColor
= rColor
;
677 mpData
->maDarkShadowColor
= Color( COL_BLACK
);
678 if ( rColor
!= Color( COL_LIGHTGRAY
) )
680 mpData
->maLightColor
= rColor
;
681 mpData
->maShadowColor
= rColor
;
682 mpData
->maLightColor
.IncreaseLuminance( 64 );
683 mpData
->maShadowColor
.DecreaseLuminance( 64 );
684 ULONG nRed
= mpData
->maLightColor
.GetRed();
685 ULONG nGreen
= mpData
->maLightColor
.GetGreen();
686 ULONG nBlue
= mpData
->maLightColor
.GetBlue();
687 nRed
+= (ULONG
)(mpData
->maShadowColor
.GetRed());
688 nGreen
+= (ULONG
)(mpData
->maShadowColor
.GetGreen());
689 nBlue
+= (ULONG
)(mpData
->maShadowColor
.GetBlue());
690 mpData
->maCheckedColor
= Color( (BYTE
)(nRed
/2), (BYTE
)(nGreen
/2), (BYTE
)(nBlue
/2) );
694 mpData
->maCheckedColor
= Color( 0x99, 0x99, 0x99 );
695 mpData
->maLightColor
= Color( COL_WHITE
);
696 mpData
->maShadowColor
= Color( COL_GRAY
);
700 // -----------------------------------------------------------------------
702 ::rtl::OUString
StyleSettings::ImplSymbolsStyleToName( ULONG nStyle
) const
706 case STYLE_SYMBOLS_DEFAULT
: return ::rtl::OUString::createFromAscii( "default" );
707 case STYLE_SYMBOLS_HICONTRAST
: return ::rtl::OUString::createFromAscii( "hicontrast" );
708 case STYLE_SYMBOLS_INDUSTRIAL
: return ::rtl::OUString::createFromAscii( "industrial" );
709 case STYLE_SYMBOLS_CRYSTAL
: return ::rtl::OUString::createFromAscii( "crystal" );
710 case STYLE_SYMBOLS_TANGO
: return ::rtl::OUString::createFromAscii( "tango" );
711 case STYLE_SYMBOLS_CLASSIC
: return ::rtl::OUString::createFromAscii( "classic" );
712 case STYLE_SYMBOLS_OXYGEN
: return ::rtl::OUString::createFromAscii( "oxygen" );
715 return ::rtl::OUString::createFromAscii( "auto" );
718 // -----------------------------------------------------------------------
720 ULONG
StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString
&rName
) const
722 if ( rName
== ::rtl::OUString::createFromAscii( "default" ) )
723 return STYLE_SYMBOLS_DEFAULT
;
724 else if ( rName
== ::rtl::OUString::createFromAscii( "hicontrast" ) )
725 return STYLE_SYMBOLS_HICONTRAST
;
726 else if ( rName
== ::rtl::OUString::createFromAscii( "industrial" ) )
727 return STYLE_SYMBOLS_INDUSTRIAL
;
728 else if ( rName
== ::rtl::OUString::createFromAscii( "crystal" ) )
729 return STYLE_SYMBOLS_CRYSTAL
;
730 else if ( rName
== ::rtl::OUString::createFromAscii( "tango" ) )
731 return STYLE_SYMBOLS_TANGO
;
732 else if ( rName
== ::rtl::OUString::createFromAscii( "classic" ) )
733 return STYLE_SYMBOLS_CLASSIC
;
734 else if ( rName
== ::rtl::OUString::createFromAscii( "oxygen" ) )
735 return STYLE_SYMBOLS_OXYGEN
;
737 return STYLE_SYMBOLS_AUTO
;
740 // -----------------------------------------------------------------------
743 The preferred style name can be read from the desktop setting. We
744 need to find the closest theme name registered in OOo. Therefore
745 we check if any registered style name is a case-insensitive
746 substring of the preferred style name.
748 void StyleSettings::SetPreferredSymbolsStyleName( const ::rtl::OUString
&rName
)
750 if ( rName
.getLength() > 0 )
752 ::rtl::OUString
rNameLowCase( rName
.toAsciiLowerCase() );
754 for( sal_uInt32 n
= 0; n
<= STYLE_SYMBOLS_THEMES_MAX
; n
++ )
755 if ( rNameLowCase
.indexOf( ImplSymbolsStyleToName( n
) ) != -1 )
757 if (n
== STYLE_SYMBOLS_INDUSTRIAL
)
758 // The Industrial OOo icon theme is too old.
759 // The OOo Tango icon theme is closer to the current GNOME Industrial theme rules.
760 SetPreferredSymbolsStyle( STYLE_SYMBOLS_TANGO
);
762 SetPreferredSymbolsStyle( n
);
768 // -----------------------------------------------------------------------
770 ULONG
StyleSettings::GetCurrentSymbolsStyle() const
772 // style selected in Tools -> Options... -> OpenOffice.org -> View
773 ULONG nStyle
= GetSymbolsStyle();
775 if ( nStyle
== STYLE_SYMBOLS_AUTO
|| ( !CheckSymbolStyle (nStyle
) ) )
777 // the preferred style can be read from the desktop setting by the desktop native widgets modules
778 ULONG nPreferredStyle
= GetPreferredSymbolsStyle();
780 if ( nPreferredStyle
== STYLE_SYMBOLS_AUTO
|| ( !CheckSymbolStyle (nPreferredStyle
) ) )
783 // use a hardcoded desktop-specific fallback if no preferred style has been detected
784 static bool sbFallbackDesktopChecked
= false;
785 static ULONG snFallbackDesktopStyle
= STYLE_SYMBOLS_DEFAULT
;
787 if ( !sbFallbackDesktopChecked
)
789 snFallbackDesktopStyle
= GetAutoSymbolsStyle();
790 sbFallbackDesktopChecked
= true;
793 nPreferredStyle
= snFallbackDesktopStyle
;
796 if (GetHighContrastMode() && CheckSymbolStyle (STYLE_SYMBOLS_HICONTRAST
) )
797 nStyle
= STYLE_SYMBOLS_HICONTRAST
;
799 nStyle
= nPreferredStyle
;
805 // -----------------------------------------------------------------------
807 ULONG
StyleSettings::GetAutoSymbolsStyle() const
809 const ::rtl::OUString
& rDesktopEnvironment
= Application::GetDesktopEnvironment();
810 ULONG nRet
= STYLE_SYMBOLS_DEFAULT
;
815 const ::com::sun::star::uno::Any
aAny( ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::OPENSOURCECONTEXT
) );
816 sal_Int32
nValue( 0 );
823 catch ( ::com::sun::star::uno::Exception
& )
829 if( rDesktopEnvironment
.equalsIgnoreAsciiCaseAscii( "gnome" ) ||
830 rDesktopEnvironment
.equalsIgnoreAsciiCaseAscii( "windows" ) )
831 nRet
= STYLE_SYMBOLS_TANGO
;
832 else if( rDesktopEnvironment
.equalsIgnoreAsciiCaseAscii( "kde" ) )
833 nRet
= STYLE_SYMBOLS_CRYSTAL
;
834 else if( rDesktopEnvironment
.equalsIgnoreAsciiCaseAscii( "kde4" ) )
835 nRet
= STYLE_SYMBOLS_OXYGEN
;
838 // falback to any existing style
839 if ( ! CheckSymbolStyle (nRet
) )
841 for ( ULONG n
= 0 ; n
<= STYLE_SYMBOLS_THEMES_MAX
; n
++ )
843 ULONG nStyleToCheck
= n
;
845 // auto is not a real theme => can't be fallback
846 if ( nStyleToCheck
== STYLE_SYMBOLS_AUTO
)
849 // will check hicontrast in the end
850 if ( nStyleToCheck
== STYLE_SYMBOLS_HICONTRAST
)
852 if ( nStyleToCheck
== STYLE_SYMBOLS_THEMES_MAX
)
853 nStyleToCheck
= STYLE_SYMBOLS_HICONTRAST
;
855 if ( CheckSymbolStyle ( nStyleToCheck
) )
857 nRet
= nStyleToCheck
;
858 n
= STYLE_SYMBOLS_THEMES_MAX
;
866 // -----------------------------------------------------------------------
868 bool StyleSettings::CheckSymbolStyle( ULONG nStyle
) const
870 static ImplImageTreeSingletonRef aImageTree
;
871 return aImageTree
->checkStyle( ImplSymbolsStyleToName( nStyle
) );
874 // -----------------------------------------------------------------------
876 void StyleSettings::SetStandardStyles()
879 mpData
->SetStandardStyles();
882 // -----------------------------------------------------------------------
884 void StyleSettings::SetStandardWinStyles()
886 return; // no more style changes since NWF
889 // -----------------------------------------------------------------------
891 void StyleSettings::SetStandardOS2Styles()
893 return; // no more style changes since NWF
896 // -----------------------------------------------------------------------
898 void StyleSettings::SetStandardMacStyles()
900 return; // no more style changes since NWF
903 // -----------------------------------------------------------------------
905 void StyleSettings::SetStandardUnixStyles()
907 return; // no more style changes since NWF
910 // -----------------------------------------------------------------------
912 Color
StyleSettings::GetFaceGradientColor() const
914 // compute a brighter face color that can be used in gradients
915 // for a convex look (eg toolbars)
918 GetFaceColor().RGBtoHSB( h
, s
, b
);
921 return Color( Color::HSBtoRGB( h
, s
, b
) );
924 // -----------------------------------------------------------------------
926 Color
StyleSettings::GetSeparatorColor() const
928 // compute a brighter shadow color for separators (used in toolbars or between menubar and toolbars on Windows XP)
930 GetShadowColor().RGBtoHSB( h
, s
, b
);
933 return Color( Color::HSBtoRGB( h
, s
, b
) );
936 // -----------------------------------------------------------------------
938 const StyleSettings
& StyleSettings::operator =( const StyleSettings
& rSet
)
940 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "StyleSettings: RefCount overflow" );
942 // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
943 rSet
.mpData
->mnRefCount
++;
945 // Daten loeschen, wenn letzte Referenz
946 if ( mpData
->mnRefCount
== 1 )
949 mpData
->mnRefCount
--;
951 mpData
= rSet
.mpData
;
956 // -----------------------------------------------------------------------
958 void StyleSettings::CopyData()
960 // Falls noch andere Referenzen bestehen, dann kopieren
961 if ( mpData
->mnRefCount
!= 1 )
963 mpData
->mnRefCount
--;
964 mpData
= new ImplStyleData( *mpData
);
968 // -----------------------------------------------------------------------
970 inline BOOL
ImplIsBackOrWhite( const Color
& rColor
)
972 UINT8 nLuminance
= rColor
.GetLuminance();
973 return ( nLuminance
< 8 ) || ( nLuminance
> 250 );
976 BOOL
StyleSettings::IsHighContrastBlackAndWhite() const
980 // Only use B&W if fully B&W, like on GNOME.
981 // Some colors like CheckedColor and HighlightColor are not B&W in Windows Standard HC Black,
982 // and we don't want to be B&W then, so check these color first, very probably not B&W.
984 // Unfortunately, GNOME uses a very very dark color (0x000033) instead of BLACK (0x000000)
986 if ( !ImplIsBackOrWhite( GetFaceColor() ) )
988 else if ( !ImplIsBackOrWhite( GetHighlightTextColor() ) )
990 else if ( !ImplIsBackOrWhite( GetWindowColor() ) )
992 else if ( !ImplIsBackOrWhite( GetWindowTextColor() ) )
994 else if ( !ImplIsBackOrWhite( GetButtonTextColor() ) )
996 else if ( !ImplIsBackOrWhite( GetButtonTextColor() ) )
998 else if ( !ImplIsBackOrWhite( GetGroupTextColor() ) )
1000 else if ( !ImplIsBackOrWhite( GetLabelTextColor() ) )
1002 else if ( !ImplIsBackOrWhite( GetDialogColor() ) )
1004 else if ( !ImplIsBackOrWhite( GetFieldColor() ) )
1006 else if ( !ImplIsBackOrWhite( GetMenuColor() ) )
1008 else if ( !ImplIsBackOrWhite( GetMenuBarColor() ) )
1010 else if ( !ImplIsBackOrWhite( GetMenuHighlightColor() ) )
1016 // -----------------------------------------------------------------------
1018 BOOL
StyleSettings::operator ==( const StyleSettings
& rSet
) const
1020 if ( mpData
== rSet
.mpData
)
1023 if ( (mpData
->mnOptions
== rSet
.mpData
->mnOptions
) &&
1024 (mpData
->mnAutoMnemonic
== rSet
.mpData
->mnAutoMnemonic
) &&
1025 (mpData
->mnLogoDisplayTime
== rSet
.mpData
->mnLogoDisplayTime
) &&
1026 (mpData
->mnDragFullOptions
== rSet
.mpData
->mnDragFullOptions
) &&
1027 (mpData
->mnAnimationOptions
== rSet
.mpData
->mnAnimationOptions
) &&
1028 (mpData
->mnSelectionOptions
== rSet
.mpData
->mnSelectionOptions
) &&
1029 (mpData
->mnDisplayOptions
== rSet
.mpData
->mnDisplayOptions
) &&
1030 (mpData
->mnCursorSize
== rSet
.mpData
->mnCursorSize
) &&
1031 (mpData
->mnCursorBlinkTime
== rSet
.mpData
->mnCursorBlinkTime
) &&
1032 (mpData
->mnBorderSize
== rSet
.mpData
->mnBorderSize
) &&
1033 (mpData
->mnTitleHeight
== rSet
.mpData
->mnTitleHeight
) &&
1034 (mpData
->mnFloatTitleHeight
== rSet
.mpData
->mnFloatTitleHeight
) &&
1035 (mpData
->mnTearOffTitleHeight
== rSet
.mpData
->mnTearOffTitleHeight
) &&
1036 (mpData
->mnMenuBarHeight
== rSet
.mpData
->mnMenuBarHeight
) &&
1037 (mpData
->mnScrollBarSize
== rSet
.mpData
->mnScrollBarSize
) &&
1038 (mpData
->mnMinThumbSize
== rSet
.mpData
->mnMinThumbSize
) &&
1039 (mpData
->mnSplitSize
== rSet
.mpData
->mnSplitSize
) &&
1040 (mpData
->mnSpinSize
== rSet
.mpData
->mnSpinSize
) &&
1041 (mpData
->mnIconHorzSpace
== rSet
.mpData
->mnIconHorzSpace
) &&
1042 (mpData
->mnIconVertSpace
== rSet
.mpData
->mnIconVertSpace
) &&
1043 (mpData
->mnAntialiasedMin
== rSet
.mpData
->mnAntialiasedMin
) &&
1044 (mpData
->mnScreenZoom
== rSet
.mpData
->mnScreenZoom
) &&
1045 (mpData
->mnScreenFontZoom
== rSet
.mpData
->mnScreenFontZoom
) &&
1046 (mpData
->mnRadioButtonStyle
== rSet
.mpData
->mnRadioButtonStyle
) &&
1047 (mpData
->mnCheckBoxStyle
== rSet
.mpData
->mnCheckBoxStyle
) &&
1048 (mpData
->mnPushButtonStyle
== rSet
.mpData
->mnPushButtonStyle
) &&
1049 (mpData
->mnTabControlStyle
== rSet
.mpData
->mnTabControlStyle
) &&
1050 (mpData
->mnHighContrast
== rSet
.mpData
->mnHighContrast
) &&
1051 (mpData
->mnUseSystemUIFonts
== rSet
.mpData
->mnUseSystemUIFonts
) &&
1052 (mpData
->mnUseFlatBorders
== rSet
.mpData
->mnUseFlatBorders
) &&
1053 (mpData
->mnUseFlatMenues
== rSet
.mpData
->mnUseFlatMenues
) &&
1054 (mpData
->maFaceColor
== rSet
.mpData
->maFaceColor
) &&
1055 (mpData
->maCheckedColor
== rSet
.mpData
->maCheckedColor
) &&
1056 (mpData
->maLightColor
== rSet
.mpData
->maLightColor
) &&
1057 (mpData
->maLightBorderColor
== rSet
.mpData
->maLightBorderColor
) &&
1058 (mpData
->maShadowColor
== rSet
.mpData
->maShadowColor
) &&
1059 (mpData
->maDarkShadowColor
== rSet
.mpData
->maDarkShadowColor
) &&
1060 (mpData
->maButtonTextColor
== rSet
.mpData
->maButtonTextColor
) &&
1061 (mpData
->maRadioCheckTextColor
== rSet
.mpData
->maRadioCheckTextColor
) &&
1062 (mpData
->maGroupTextColor
== rSet
.mpData
->maGroupTextColor
) &&
1063 (mpData
->maLabelTextColor
== rSet
.mpData
->maLabelTextColor
) &&
1064 (mpData
->maInfoTextColor
== rSet
.mpData
->maInfoTextColor
) &&
1065 (mpData
->maWindowColor
== rSet
.mpData
->maWindowColor
) &&
1066 (mpData
->maWindowTextColor
== rSet
.mpData
->maWindowTextColor
) &&
1067 (mpData
->maDialogColor
== rSet
.mpData
->maDialogColor
) &&
1068 (mpData
->maDialogTextColor
== rSet
.mpData
->maDialogTextColor
) &&
1069 (mpData
->maWorkspaceColor
== rSet
.mpData
->maWorkspaceColor
) &&
1070 (mpData
->maMonoColor
== rSet
.mpData
->maMonoColor
) &&
1071 (mpData
->maFieldColor
== rSet
.mpData
->maFieldColor
) &&
1072 (mpData
->maFieldTextColor
== rSet
.mpData
->maFieldTextColor
) &&
1073 (mpData
->maActiveColor
== rSet
.mpData
->maActiveColor
) &&
1074 (mpData
->maActiveColor2
== rSet
.mpData
->maActiveColor2
) &&
1075 (mpData
->maActiveTextColor
== rSet
.mpData
->maActiveTextColor
) &&
1076 (mpData
->maActiveBorderColor
== rSet
.mpData
->maActiveBorderColor
) &&
1077 (mpData
->maDeactiveColor
== rSet
.mpData
->maDeactiveColor
) &&
1078 (mpData
->maDeactiveColor2
== rSet
.mpData
->maDeactiveColor2
) &&
1079 (mpData
->maDeactiveTextColor
== rSet
.mpData
->maDeactiveTextColor
) &&
1080 (mpData
->maDeactiveBorderColor
== rSet
.mpData
->maDeactiveBorderColor
) &&
1081 (mpData
->maMenuColor
== rSet
.mpData
->maMenuColor
) &&
1082 (mpData
->maMenuBarColor
== rSet
.mpData
->maMenuBarColor
) &&
1083 (mpData
->maMenuBorderColor
== rSet
.mpData
->maMenuBorderColor
) &&
1084 (mpData
->maMenuTextColor
== rSet
.mpData
->maMenuTextColor
) &&
1085 (mpData
->maMenuBarTextColor
== rSet
.mpData
->maMenuBarTextColor
) &&
1086 (mpData
->maMenuHighlightColor
== rSet
.mpData
->maMenuHighlightColor
) &&
1087 (mpData
->maMenuHighlightTextColor
== rSet
.mpData
->maMenuHighlightTextColor
) &&
1088 (mpData
->maHighlightColor
== rSet
.mpData
->maHighlightColor
) &&
1089 (mpData
->maHighlightTextColor
== rSet
.mpData
->maHighlightTextColor
) &&
1090 (mpData
->maActiveTabColor
== rSet
.mpData
->maActiveTabColor
) &&
1091 (mpData
->maInactiveTabColor
== rSet
.mpData
->maInactiveTabColor
) &&
1092 (mpData
->maDisableColor
== rSet
.mpData
->maDisableColor
) &&
1093 (mpData
->maHelpColor
== rSet
.mpData
->maHelpColor
) &&
1094 (mpData
->maHelpTextColor
== rSet
.mpData
->maHelpTextColor
) &&
1095 (mpData
->maLinkColor
== rSet
.mpData
->maLinkColor
) &&
1096 (mpData
->maVisitedLinkColor
== rSet
.mpData
->maVisitedLinkColor
) &&
1097 (mpData
->maHighlightLinkColor
== rSet
.mpData
->maHighlightLinkColor
) &&
1098 (mpData
->maAppFont
== rSet
.mpData
->maAppFont
) &&
1099 (mpData
->maHelpFont
== rSet
.mpData
->maHelpFont
) &&
1100 (mpData
->maTitleFont
== rSet
.mpData
->maTitleFont
) &&
1101 (mpData
->maFloatTitleFont
== rSet
.mpData
->maFloatTitleFont
) &&
1102 (mpData
->maMenuFont
== rSet
.mpData
->maMenuFont
) &&
1103 (mpData
->maToolFont
== rSet
.mpData
->maToolFont
) &&
1104 (mpData
->maGroupFont
== rSet
.mpData
->maGroupFont
) &&
1105 (mpData
->maLabelFont
== rSet
.mpData
->maLabelFont
) &&
1106 (mpData
->maInfoFont
== rSet
.mpData
->maInfoFont
) &&
1107 (mpData
->maRadioCheckFont
== rSet
.mpData
->maRadioCheckFont
) &&
1108 (mpData
->maPushButtonFont
== rSet
.mpData
->maPushButtonFont
) &&
1109 (mpData
->maFieldFont
== rSet
.mpData
->maFieldFont
) &&
1110 (mpData
->maIconFont
== rSet
.mpData
->maIconFont
) &&
1111 (mpData
->mnUseImagesInMenus
== rSet
.mpData
->mnUseImagesInMenus
) &&
1112 (mpData
->mnSkipDisabledInMenus
== rSet
.mpData
->mnSkipDisabledInMenus
) &&
1113 (mpData
->maFontColor
== rSet
.mpData
->maFontColor
))
1119 // =======================================================================
1121 ImplMiscData::ImplMiscData()
1124 mnTwoDigitYearStart
= 1930;
1125 mnEnableATT
= sal::static_int_cast
<USHORT
>(~0U);
1126 mnDisablePrinting
= sal::static_int_cast
<USHORT
>(~0U);
1127 static const char* pEnv
= getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI
1128 mbEnableLocalizedDecimalSep
= (pEnv
!= NULL
) ? TRUE
: FALSE
;
1131 // -----------------------------------------------------------------------
1133 ImplMiscData::ImplMiscData( const ImplMiscData
& rData
)
1136 mnTwoDigitYearStart
= rData
.mnTwoDigitYearStart
;
1137 mnEnableATT
= rData
.mnEnableATT
;
1138 mnDisablePrinting
= rData
.mnDisablePrinting
;
1139 mbEnableLocalizedDecimalSep
= rData
.mbEnableLocalizedDecimalSep
;
1142 // -----------------------------------------------------------------------
1144 MiscSettings::MiscSettings()
1146 mpData
= new ImplMiscData();
1149 // -----------------------------------------------------------------------
1151 MiscSettings::MiscSettings( const MiscSettings
& rSet
)
1153 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "MiscSettings: RefCount overflow" );
1155 // shared Instance Daten uebernehmen und Referenzcounter erhoehen
1156 mpData
= rSet
.mpData
;
1157 mpData
->mnRefCount
++;
1160 // -----------------------------------------------------------------------
1162 MiscSettings::~MiscSettings()
1164 // Daten loeschen, wenn letzte Referenz
1165 if ( mpData
->mnRefCount
== 1 )
1168 mpData
->mnRefCount
--;
1171 // -----------------------------------------------------------------------
1173 const MiscSettings
& MiscSettings::operator =( const MiscSettings
& rSet
)
1175 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "MiscSettings: RefCount overflow" );
1177 // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
1178 rSet
.mpData
->mnRefCount
++;
1180 // Daten loeschen, wenn letzte Referenz
1181 if ( mpData
->mnRefCount
== 1 )
1184 mpData
->mnRefCount
--;
1186 mpData
= rSet
.mpData
;
1191 // -----------------------------------------------------------------------
1193 void MiscSettings::CopyData()
1195 // Falls noch andere Referenzen bestehen, dann kopieren
1196 if ( mpData
->mnRefCount
!= 1 )
1198 mpData
->mnRefCount
--;
1199 mpData
= new ImplMiscData( *mpData
);
1203 // -----------------------------------------------------------------------
1205 BOOL
MiscSettings::operator ==( const MiscSettings
& rSet
) const
1207 if ( mpData
== rSet
.mpData
)
1210 if ( (mpData
->mnTwoDigitYearStart
== rSet
.mpData
->mnTwoDigitYearStart
) &&
1211 (mpData
->mnEnableATT
== rSet
.mpData
->mnEnableATT
) &&
1212 (mpData
->mnDisablePrinting
== rSet
.mpData
->mnDisablePrinting
) &&
1213 (mpData
->mbEnableLocalizedDecimalSep
== rSet
.mpData
->mbEnableLocalizedDecimalSep
) )
1219 // -----------------------------------------------------------------------
1221 BOOL
MiscSettings::GetDisablePrinting() const
1223 if( mpData
->mnDisablePrinting
== (USHORT
)~0 )
1225 rtl::OUString aEnable
=
1226 vcl::SettingsConfigItem::get()->
1227 getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DesktopManagement" ) ),
1228 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisablePrinting" ) ) );
1229 mpData
->mnDisablePrinting
= aEnable
.equalsIgnoreAsciiCaseAscii( "true" ) ? 1 : 0;
1232 return (BOOL
)mpData
->mnDisablePrinting
;
1234 // -----------------------------------------------------------------------
1236 BOOL
MiscSettings::GetEnableATToolSupport() const
1240 if( mpData
->mnEnableATT
== (USHORT
)~0 )
1242 // Check in the Windows registry if an AT tool wants Accessibility support to
1246 if( ERROR_SUCCESS
== RegOpenKey(HKEY_CURRENT_USER
,
1247 "Software\\OpenOffice.org\\Accessibility\\AtToolSupport",
1251 WIN_BYTE Data
[6]; // possible values: "true", "false", "1", "0", DWORD
1252 DWORD cbData
= sizeof(Data
);
1254 if( ERROR_SUCCESS
== RegQueryValueEx(hkey
, "SupportAssistiveTechnology",
1255 NULL
, &dwType
, Data
, &cbData
) )
1260 mpData
->mnEnableATT
= ((0 == stricmp((const char *) Data
, "1")) || (0 == stricmp((const char *) Data
, "true")));
1263 mpData
->mnEnableATT
= (USHORT
) (((DWORD
*) Data
)[0]);
1266 // Unsupported registry type
1276 if( mpData
->mnEnableATT
== (USHORT
)~0 )
1278 static const char* pEnv
= getenv("SAL_ACCESSIBILITY_ENABLED" );
1279 if( !pEnv
|| !*pEnv
)
1281 rtl::OUString aEnable
=
1282 vcl::SettingsConfigItem::get()->
1283 getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Accessibility" ) ),
1284 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableATToolSupport" ) ) );
1285 mpData
->mnEnableATT
= aEnable
.equalsIgnoreAsciiCaseAscii( "true" ) ? 1 : 0;
1289 mpData
->mnEnableATT
= 1;
1293 return (BOOL
)mpData
->mnEnableATT
;
1296 // -----------------------------------------------------------------------
1298 void MiscSettings::SetDisablePrinting( BOOL bEnable
)
1300 if ( bEnable
!= mpData
->mnDisablePrinting
)
1302 vcl::SettingsConfigItem::get()->
1303 setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DesktopManagement" ) ),
1304 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisablePrinting" ) ),
1305 rtl::OUString::createFromAscii( bEnable
? "true" : "false" ) );
1306 mpData
->mnDisablePrinting
= bEnable
? 1 : 0;
1310 // -----------------------------------------------------------------------
1312 void MiscSettings::SetEnableATToolSupport( BOOL bEnable
)
1314 if ( bEnable
!= mpData
->mnEnableATT
)
1317 if( bEnable
&& !ImplInitAccessBridge(false, bDummy
) )
1323 // If the accessibility key in the Windows registry exists, change it synchronously
1324 if( ERROR_SUCCESS
== RegOpenKey(HKEY_CURRENT_USER
,
1325 "Software\\OpenOffice.org\\Accessibility\\AtToolSupport",
1329 WIN_BYTE Data
[6]; // possible values: "true", "false", 1, 0
1330 DWORD cbData
= sizeof(Data
);
1332 if( ERROR_SUCCESS
== RegQueryValueEx(hkey
, "SupportAssistiveTechnology",
1333 NULL
, &dwType
, Data
, &cbData
) )
1338 RegSetValueEx(hkey
, "SupportAssistiveTechnology",
1340 bEnable
? (WIN_BYTE
*) "true" : (WIN_BYTE
*) "false",
1341 bEnable
? sizeof("true") : sizeof("false"));
1344 ((DWORD
*) Data
)[0] = bEnable
? 1 : 0;
1345 RegSetValueEx(hkey
, "SupportAssistiveTechnology",
1346 NULL
, dwType
, Data
, sizeof(DWORD
));
1349 // Unsupported registry type
1358 vcl::SettingsConfigItem::get()->
1359 setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Accessibility" ) ),
1360 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableATToolSupport" ) ),
1361 rtl::OUString::createFromAscii( bEnable
? "true" : "false" ) );
1362 mpData
->mnEnableATT
= bEnable
? 1 : 0;
1366 void MiscSettings::SetEnableLocalizedDecimalSep( BOOL bEnable
)
1369 mpData
->mbEnableLocalizedDecimalSep
= bEnable
;
1372 BOOL
MiscSettings::GetEnableLocalizedDecimalSep() const
1374 return mpData
->mbEnableLocalizedDecimalSep
;
1377 // =======================================================================
1379 ImplNotificationData::ImplNotificationData()
1385 // -----------------------------------------------------------------------
1387 ImplNotificationData::ImplNotificationData( const ImplNotificationData
& rData
)
1390 mnOptions
= rData
.mnOptions
;
1393 // -----------------------------------------------------------------------
1395 NotificationSettings::NotificationSettings()
1397 mpData
= new ImplNotificationData();
1400 // -----------------------------------------------------------------------
1402 NotificationSettings::NotificationSettings( const NotificationSettings
& rSet
)
1404 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "NotificationSettings: RefCount overflow" );
1406 // shared Instance Daten uebernehmen und Referenzcounter erhoehen
1407 mpData
= rSet
.mpData
;
1408 mpData
->mnRefCount
++;
1411 // -----------------------------------------------------------------------
1413 NotificationSettings::~NotificationSettings()
1415 // Daten loeschen, wenn letzte Referenz
1416 if ( mpData
->mnRefCount
== 1 )
1419 mpData
->mnRefCount
--;
1422 // -----------------------------------------------------------------------
1424 const NotificationSettings
& NotificationSettings::operator =( const NotificationSettings
& rSet
)
1426 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "NotificationSettings: RefCount overflow" );
1428 // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
1429 rSet
.mpData
->mnRefCount
++;
1431 // Daten loeschen, wenn letzte Referenz
1432 if ( mpData
->mnRefCount
== 1 )
1435 mpData
->mnRefCount
--;
1437 mpData
= rSet
.mpData
;
1442 // -----------------------------------------------------------------------
1444 void NotificationSettings::CopyData()
1446 // Falls noch andere Referenzen bestehen, dann kopieren
1447 if ( mpData
->mnRefCount
!= 1 )
1449 mpData
->mnRefCount
--;
1450 mpData
= new ImplNotificationData( *mpData
);
1454 // -----------------------------------------------------------------------
1456 BOOL
NotificationSettings::operator ==( const NotificationSettings
& rSet
) const
1458 if ( mpData
== rSet
.mpData
)
1461 if ( (mpData
->mnOptions
== rSet
.mpData
->mnOptions
) )
1467 // =======================================================================
1469 ImplHelpData::ImplHelpData()
1474 mnTipTimeout
= 3000;
1475 mnBalloonDelay
= 1500;
1478 // -----------------------------------------------------------------------
1480 ImplHelpData::ImplHelpData( const ImplHelpData
& rData
)
1483 mnOptions
= rData
.mnOptions
;
1484 mnTipDelay
= rData
.mnTipDelay
;
1485 mnTipTimeout
= rData
.mnTipTimeout
;
1486 mnBalloonDelay
= rData
.mnBalloonDelay
;
1489 // -----------------------------------------------------------------------
1491 HelpSettings::HelpSettings()
1493 mpData
= new ImplHelpData();
1496 // -----------------------------------------------------------------------
1498 HelpSettings::HelpSettings( const HelpSettings
& rSet
)
1500 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "HelpSettings: RefCount overflow" );
1502 // shared Instance Daten uebernehmen und Referenzcounter erhoehen
1503 mpData
= rSet
.mpData
;
1504 mpData
->mnRefCount
++;
1507 // -----------------------------------------------------------------------
1509 HelpSettings::~HelpSettings()
1511 // Daten loeschen, wenn letzte Referenz
1512 if ( mpData
->mnRefCount
== 1 )
1515 mpData
->mnRefCount
--;
1518 // -----------------------------------------------------------------------
1520 const HelpSettings
& HelpSettings::operator =( const HelpSettings
& rSet
)
1522 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "HelpSettings: RefCount overflow" );
1524 // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
1525 rSet
.mpData
->mnRefCount
++;
1527 // Daten loeschen, wenn letzte Referenz
1528 if ( mpData
->mnRefCount
== 1 )
1531 mpData
->mnRefCount
--;
1533 mpData
= rSet
.mpData
;
1538 // -----------------------------------------------------------------------
1540 void HelpSettings::CopyData()
1542 // Falls noch andere Referenzen bestehen, dann kopieren
1543 if ( mpData
->mnRefCount
!= 1 )
1545 mpData
->mnRefCount
--;
1546 mpData
= new ImplHelpData( *mpData
);
1550 // -----------------------------------------------------------------------
1552 BOOL
HelpSettings::operator ==( const HelpSettings
& rSet
) const
1554 if ( mpData
== rSet
.mpData
)
1557 if ( (mpData
->mnOptions
== rSet
.mpData
->mnOptions
) &&
1558 (mpData
->mnTipDelay
== rSet
.mpData
->mnTipDelay
) &&
1559 (mpData
->mnTipTimeout
== rSet
.mpData
->mnTipTimeout
) &&
1560 (mpData
->mnBalloonDelay
== rSet
.mpData
->mnBalloonDelay
) )
1566 // =======================================================================
1568 static BOOL
ImplCompareLocales( const ::com::sun::star::lang::Locale
& L1
, const ::com::sun::star::lang::Locale
& L2
)
1570 return ( ( L1
.Language
== L2
.Language
) &&
1571 ( L1
.Country
== L2
.Country
) &&
1572 ( L1
.Variant
== L2
.Variant
) );
1575 // =======================================================================
1577 ImplAllSettingsData::ImplAllSettingsData()
1580 mnSystemUpdate
= SETTINGS_ALLSETTINGS
;
1581 mnWindowUpdate
= SETTINGS_ALLSETTINGS
;
1582 meLanguage
= LANGUAGE_SYSTEM
;
1583 meUILanguage
= LANGUAGE_SYSTEM
;
1584 mpLocaleDataWrapper
= NULL
;
1585 mpUILocaleDataWrapper
= NULL
;
1586 mpCollatorWrapper
= NULL
;
1587 mpUICollatorWrapper
= NULL
;
1588 mpI18nHelper
= NULL
;
1589 mpUII18nHelper
= NULL
;
1592 // -----------------------------------------------------------------------
1594 ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData
& rData
) :
1595 maMouseSettings( rData
.maMouseSettings
),
1596 maKeyboardSettings( rData
.maKeyboardSettings
),
1597 maStyleSettings( rData
.maStyleSettings
),
1598 maMiscSettings( rData
.maMiscSettings
),
1599 maNotificationSettings( rData
.maNotificationSettings
),
1600 maHelpSettings( rData
.maHelpSettings
),
1601 maLocale( rData
.maLocale
),
1602 maUILocale( rData
.maUILocale
)
1606 mnSystemUpdate
= rData
.mnSystemUpdate
;
1607 mnWindowUpdate
= rData
.mnWindowUpdate
;
1608 meLanguage
= rData
.meLanguage
;
1609 meUILanguage
= rData
.meUILanguage
;
1610 // Pointer couldn't shared and objects haven't a copy ctor
1611 // So we create the cache objects new, if the GetFunction is
1613 mpLocaleDataWrapper
= NULL
;
1614 mpUILocaleDataWrapper
= NULL
;
1615 mpCollatorWrapper
= NULL
;
1616 mpUICollatorWrapper
= NULL
;
1617 mpI18nHelper
= NULL
;
1618 mpUII18nHelper
= NULL
;
1621 // -----------------------------------------------------------------------
1623 ImplAllSettingsData::~ImplAllSettingsData()
1625 if ( mpLocaleDataWrapper
)
1626 delete mpLocaleDataWrapper
;
1627 if ( mpUILocaleDataWrapper
)
1628 delete mpUILocaleDataWrapper
;
1629 if ( mpCollatorWrapper
)
1630 delete mpCollatorWrapper
;
1631 if ( mpUICollatorWrapper
)
1632 delete mpUICollatorWrapper
;
1634 delete mpI18nHelper
;
1635 if ( mpUII18nHelper
)
1636 delete mpUII18nHelper
;
1639 // -----------------------------------------------------------------------
1641 AllSettings::AllSettings()
1643 DBG_CTOR( AllSettings
, NULL
);
1645 mpData
= new ImplAllSettingsData();
1648 // -----------------------------------------------------------------------
1650 AllSettings::AllSettings( const AllSettings
& rSet
)
1652 DBG_CTOR( AllSettings
, NULL
);
1653 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "Settings: RefCount overflow" );
1655 // shared Instance Daten uebernehmen und Referenzcounter erhoehen
1656 mpData
= rSet
.mpData
;
1657 mpData
->mnRefCount
++;
1660 // -----------------------------------------------------------------------
1662 AllSettings::~AllSettings()
1664 DBG_DTOR( AllSettings
, NULL
);
1666 // Daten loeschen, wenn letzte Referenz
1667 if ( mpData
->mnRefCount
== 1 )
1670 mpData
->mnRefCount
--;
1673 // -----------------------------------------------------------------------
1675 const AllSettings
& AllSettings::operator =( const AllSettings
& rSet
)
1677 DBG_ASSERT( rSet
.mpData
->mnRefCount
< 0xFFFFFFFE, "AllSettings: RefCount overflow" );
1678 DBG_CHKTHIS( AllSettings
, NULL
);
1679 DBG_CHKOBJ( &rSet
, AllSettings
, NULL
);
1681 // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
1682 rSet
.mpData
->mnRefCount
++;
1684 // Daten loeschen, wenn letzte Referenz
1685 if ( mpData
->mnRefCount
== 1 )
1688 mpData
->mnRefCount
--;
1690 mpData
= rSet
.mpData
;
1695 // -----------------------------------------------------------------------
1697 void AllSettings::CopyData()
1699 DBG_CHKTHIS( AllSettings
, NULL
);
1701 // Falls noch andere Referenzen bestehen, dann kopieren
1702 if ( mpData
->mnRefCount
!= 1 )
1704 mpData
->mnRefCount
--;
1705 mpData
= new ImplAllSettingsData( *mpData
);
1709 // -----------------------------------------------------------------------
1711 ULONG
AllSettings::Update( ULONG nFlags
, const AllSettings
& rSet
)
1713 DBG_CHKTHIS( AllSettings
, NULL
);
1714 DBG_CHKOBJ( &rSet
, AllSettings
, NULL
);
1716 ULONG nChangeFlags
= 0;
1718 if ( nFlags
& SETTINGS_MACHINE
)
1720 if ( mpData
->maMachineSettings
!= rSet
.mpData
->maMachineSettings
)
1723 mpData
->maMachineSettings
= rSet
.mpData
->maMachineSettings
;
1724 nChangeFlags
|= SETTINGS_MACHINE
;
1728 if ( nFlags
& SETTINGS_MOUSE
)
1730 if ( mpData
->maMouseSettings
!= rSet
.mpData
->maMouseSettings
)
1733 mpData
->maMouseSettings
= rSet
.mpData
->maMouseSettings
;
1734 nChangeFlags
|= SETTINGS_MOUSE
;
1738 if ( nFlags
& SETTINGS_KEYBOARD
)
1740 if ( mpData
->maKeyboardSettings
!= rSet
.mpData
->maKeyboardSettings
)
1743 mpData
->maKeyboardSettings
= rSet
.mpData
->maKeyboardSettings
;
1744 nChangeFlags
|= SETTINGS_KEYBOARD
;
1748 if ( nFlags
& SETTINGS_STYLE
)
1750 if ( mpData
->maStyleSettings
!= rSet
.mpData
->maStyleSettings
)
1753 mpData
->maStyleSettings
= rSet
.mpData
->maStyleSettings
;
1754 nChangeFlags
|= SETTINGS_STYLE
;
1758 if ( nFlags
& SETTINGS_MISC
)
1760 if ( mpData
->maMiscSettings
!= rSet
.mpData
->maMiscSettings
)
1763 mpData
->maMiscSettings
= rSet
.mpData
->maMiscSettings
;
1764 nChangeFlags
|= SETTINGS_MISC
;
1768 if ( nFlags
& SETTINGS_NOTIFICATION
)
1770 if ( mpData
->maNotificationSettings
!= rSet
.mpData
->maNotificationSettings
)
1773 mpData
->maNotificationSettings
= rSet
.mpData
->maNotificationSettings
;
1774 nChangeFlags
|= SETTINGS_NOTIFICATION
;
1778 if ( nFlags
& SETTINGS_HELP
)
1780 if ( mpData
->maHelpSettings
!= rSet
.mpData
->maHelpSettings
)
1783 mpData
->maHelpSettings
= rSet
.mpData
->maHelpSettings
;
1784 nChangeFlags
|= SETTINGS_HELP
;
1788 if ( nFlags
& SETTINGS_INTERNATIONAL
)
1790 // Nothing, class International is gone.
1791 DBG_ERRORFILE("AllSettings::Update: who calls with SETTINGS_INTERNATIONAL and why? You're flogging a dead horse.");
1794 if ( nFlags
& SETTINGS_LOCALE
)
1796 if ( mpData
->meLanguage
|| rSet
.mpData
->meLanguage
)
1798 SetLanguage( rSet
.mpData
->meLanguage
);
1799 nChangeFlags
|= SETTINGS_LOCALE
;
1803 if ( nFlags
& SETTINGS_UILOCALE
)
1805 if ( mpData
->meUILanguage
|| rSet
.mpData
->meUILanguage
)
1807 SetUILanguage( rSet
.mpData
->meUILanguage
);
1808 nChangeFlags
|= SETTINGS_UILOCALE
;
1812 return nChangeFlags
;
1815 // -----------------------------------------------------------------------
1817 ULONG
AllSettings::GetChangeFlags( const AllSettings
& rSet
) const
1819 DBG_CHKTHIS( AllSettings
, NULL
);
1820 DBG_CHKOBJ( &rSet
, AllSettings
, NULL
);
1822 ULONG nChangeFlags
= 0;
1824 if ( mpData
->maMachineSettings
!= rSet
.mpData
->maMachineSettings
)
1825 nChangeFlags
|= SETTINGS_MACHINE
;
1827 if ( mpData
->maMouseSettings
!= rSet
.mpData
->maMouseSettings
)
1828 nChangeFlags
|= SETTINGS_MOUSE
;
1830 if ( mpData
->maKeyboardSettings
!= rSet
.mpData
->maKeyboardSettings
)
1831 nChangeFlags
|= SETTINGS_KEYBOARD
;
1833 if ( mpData
->maStyleSettings
!= rSet
.mpData
->maStyleSettings
)
1834 nChangeFlags
|= SETTINGS_STYLE
;
1836 if ( mpData
->maMiscSettings
!= rSet
.mpData
->maMiscSettings
)
1837 nChangeFlags
|= SETTINGS_MISC
;
1839 if ( mpData
->maNotificationSettings
!= rSet
.mpData
->maNotificationSettings
)
1840 nChangeFlags
|= SETTINGS_NOTIFICATION
;
1842 if ( mpData
->maHelpSettings
!= rSet
.mpData
->maHelpSettings
)
1843 nChangeFlags
|= SETTINGS_HELP
;
1845 if ( mpData
->meLanguage
|| rSet
.mpData
->meLanguage
)
1846 nChangeFlags
|= SETTINGS_LOCALE
;
1848 if ( mpData
->meUILanguage
|| rSet
.mpData
->meUILanguage
)
1849 nChangeFlags
|= SETTINGS_UILOCALE
;
1851 return nChangeFlags
;
1854 // -----------------------------------------------------------------------
1856 BOOL
AllSettings::operator ==( const AllSettings
& rSet
) const
1858 DBG_CHKTHIS( AllSettings
, NULL
);
1859 DBG_CHKOBJ( &rSet
, AllSettings
, NULL
);
1861 if ( mpData
== rSet
.mpData
)
1864 if ( (mpData
->maMachineSettings
== rSet
.mpData
->maMachineSettings
) &&
1865 (mpData
->maMouseSettings
== rSet
.mpData
->maMouseSettings
) &&
1866 (mpData
->maKeyboardSettings
== rSet
.mpData
->maKeyboardSettings
) &&
1867 (mpData
->maStyleSettings
== rSet
.mpData
->maStyleSettings
) &&
1868 (mpData
->maMiscSettings
== rSet
.mpData
->maMiscSettings
) &&
1869 (mpData
->maNotificationSettings
== rSet
.mpData
->maNotificationSettings
) &&
1870 (mpData
->maHelpSettings
== rSet
.mpData
->maHelpSettings
) &&
1871 (mpData
->mnSystemUpdate
== rSet
.mpData
->mnSystemUpdate
) &&
1872 (mpData
->mnWindowUpdate
== rSet
.mpData
->mnWindowUpdate
) )
1874 // special treatment for Locale, because maLocale is only
1875 // initialized after first call of GetLocale().
1876 ::com::sun::star::lang::Locale aEmptyLocale
;
1877 if ( ( ImplCompareLocales( mpData
->maLocale
, aEmptyLocale
) && ImplCompareLocales( rSet
.mpData
->maLocale
, aEmptyLocale
) )
1878 || ImplCompareLocales( GetLocale(), rSet
.GetLocale() ) )
1886 // -----------------------------------------------------------------------
1888 void AllSettings::SetLocale( const ::com::sun::star::lang::Locale
& rLocale
)
1892 mpData
->maLocale
= rLocale
;
1894 if ( !rLocale
.Language
.getLength() )
1895 mpData
->meLanguage
= LANGUAGE_SYSTEM
;
1897 mpData
->meLanguage
= MsLangId::convertLocaleToLanguage( rLocale
);
1898 if ( mpData
->mpLocaleDataWrapper
)
1900 delete mpData
->mpLocaleDataWrapper
;
1901 mpData
->mpLocaleDataWrapper
= NULL
;
1903 if ( mpData
->mpI18nHelper
)
1905 delete mpData
->mpI18nHelper
;
1906 mpData
->mpI18nHelper
= NULL
;
1910 // -----------------------------------------------------------------------
1912 void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale
& rLocale
)
1916 mpData
->maUILocale
= rLocale
;
1918 if ( !rLocale
.Language
.getLength() )
1919 mpData
->meUILanguage
= LANGUAGE_SYSTEM
;
1921 mpData
->meUILanguage
= MsLangId::convertLocaleToLanguage( rLocale
);
1922 if ( mpData
->mpUILocaleDataWrapper
)
1924 delete mpData
->mpUILocaleDataWrapper
;
1925 mpData
->mpUILocaleDataWrapper
= NULL
;
1927 if ( mpData
->mpUII18nHelper
)
1929 delete mpData
->mpUII18nHelper
;
1930 mpData
->mpUII18nHelper
= NULL
;
1934 // -----------------------------------------------------------------------
1936 void AllSettings::SetLanguage( LanguageType eLang
)
1940 mpData
->meLanguage
= eLang
;
1942 // Will be calculated in GetLocale()
1943 mpData
->maLocale
= ::com::sun::star::lang::Locale();
1944 if ( mpData
->mpLocaleDataWrapper
)
1946 delete mpData
->mpLocaleDataWrapper
;
1947 mpData
->mpLocaleDataWrapper
= NULL
;
1949 if ( mpData
->mpI18nHelper
)
1951 delete mpData
->mpI18nHelper
;
1952 mpData
->mpI18nHelper
= NULL
;
1956 // -----------------------------------------------------------------------
1958 void AllSettings::SetUILanguage( LanguageType eLang
)
1962 mpData
->meUILanguage
= eLang
;
1964 // Will be calculated in GetUILocale()
1965 mpData
->maUILocale
= ::com::sun::star::lang::Locale();
1966 if ( mpData
->mpUILocaleDataWrapper
)
1968 delete mpData
->mpUILocaleDataWrapper
;
1969 mpData
->mpUILocaleDataWrapper
= NULL
;
1971 if ( mpData
->mpUII18nHelper
)
1973 delete mpData
->mpUII18nHelper
;
1974 mpData
->mpUII18nHelper
= NULL
;
1978 // -----------------------------------------------------------------------
1980 BOOL
AllSettings::GetLayoutRTL() const
1982 static const char* pEnv
= getenv("SAL_RTL_ENABLED" );
1983 static int nUIMirroring
= -1; // -1: undef, 0: auto, 1: on 2: off
1985 // environment always overrides
1991 if( nUIMirroring
== -1 )
1993 nUIMirroring
= 0; // ask configuration only once
1994 utl::OConfigurationNode aNode
= utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
1995 vcl::unohelper::GetMultiServiceFactory(),
1996 OUString::createFromAscii( "org.openoffice.Office.Common/I18N/CTL" ) ); // note: case sensisitive !
1997 if ( aNode
.isValid() )
2000 ::com::sun::star::uno::Any aValue
= aNode
.getNodeValue( OUString::createFromAscii( "UIMirroring" ) );
2001 if( aValue
>>= bTmp
)
2003 // found true or false; if it was nil, nothing is changed
2004 nUIMirroring
= bTmp
? 1 : 2;
2009 if( nUIMirroring
== 0 ) // no config found (eg, setup) or default (nil) was set: check language
2011 LanguageType aLang
= LANGUAGE_DONTKNOW
;
2012 ImplSVData
* pSVData
= ImplGetSVData();
2013 if ( pSVData
->maAppData
.mpSettings
)
2014 aLang
= pSVData
->maAppData
.mpSettings
->GetUILanguage();
2015 bRTL
= MsLangId::isRightToLeft( aLang
);
2018 bRTL
= (nUIMirroring
== 1);
2023 // -----------------------------------------------------------------------
2025 const ::com::sun::star::lang::Locale
& AllSettings::GetLocale() const
2027 if ( !mpData
->maLocale
.Language
.getLength() )
2028 MsLangId::convertLanguageToLocale( GetLanguage(),
2029 ((AllSettings
*)this)->mpData
->maLocale
);
2031 return mpData
->maLocale
;
2034 // -----------------------------------------------------------------------
2036 const ::com::sun::star::lang::Locale
& AllSettings::GetUILocale() const
2038 if ( !mpData
->maUILocale
.Language
.getLength() )
2039 MsLangId::convertLanguageToLocale( GetUILanguage(),
2040 ((AllSettings
*)this)->mpData
->maUILocale
);
2042 return mpData
->maUILocale
;
2045 // -----------------------------------------------------------------------
2047 LanguageType
AllSettings::GetLanguage() const
2049 if ( mpData
->meLanguage
== LANGUAGE_SYSTEM
)
2050 return MsLangId::getSystemLanguage();
2052 return mpData
->meLanguage
;
2055 // -----------------------------------------------------------------------
2057 LanguageType
AllSettings::GetUILanguage() const
2059 if ( mpData
->meUILanguage
== LANGUAGE_SYSTEM
)
2060 return MsLangId::getSystemUILanguage();
2062 return mpData
->meUILanguage
;
2065 // -----------------------------------------------------------------------
2067 const LocaleDataWrapper
& AllSettings::GetLocaleDataWrapper() const
2069 if ( !mpData
->mpLocaleDataWrapper
)
2070 ((AllSettings
*)this)->mpData
->mpLocaleDataWrapper
= new LocaleDataWrapper( vcl::unohelper::GetMultiServiceFactory(), GetLocale() );
2071 return *mpData
->mpLocaleDataWrapper
;
2074 // -----------------------------------------------------------------------
2076 const LocaleDataWrapper
& AllSettings::GetUILocaleDataWrapper() const
2078 if ( !mpData
->mpUILocaleDataWrapper
)
2079 ((AllSettings
*)this)->mpData
->mpUILocaleDataWrapper
= new LocaleDataWrapper( vcl::unohelper::GetMultiServiceFactory(), GetUILocale() );
2080 return *mpData
->mpUILocaleDataWrapper
;
2083 // -----------------------------------------------------------------------
2085 const vcl::I18nHelper
& AllSettings::GetLocaleI18nHelper() const
2087 if ( !mpData
->mpI18nHelper
) {
2088 ::com::sun::star::uno::Reference
<com::sun::star::lang::XMultiServiceFactory
> aFactory(vcl::unohelper::GetMultiServiceFactory());
2089 ((AllSettings
*)this)->mpData
->mpI18nHelper
= new vcl::I18nHelper( aFactory
, GetLocale() );
2091 return *mpData
->mpI18nHelper
;
2094 // -----------------------------------------------------------------------
2096 const vcl::I18nHelper
& AllSettings::GetUILocaleI18nHelper() const
2098 if ( !mpData
->mpUII18nHelper
) {
2099 ::com::sun::star::uno::Reference
<com::sun::star::lang::XMultiServiceFactory
> aFactory(vcl::unohelper::GetMultiServiceFactory());
2100 ((AllSettings
*)this)->mpData
->mpUII18nHelper
= new vcl::I18nHelper( aFactory
, GetUILocale() );
2102 return *mpData
->mpUII18nHelper
;
2106 // -----------------------------------------------------------------------
2108 const CollatorWrapper& AllSettings::GetCollatorWrapper() const
2110 if ( !mpData->mpCollatorWrapper )
2112 ((AllSettings*)this)->mpData->mpCollatorWrapper = new CollatorWrapper( vcl::unohelper::GetMultiServiceFactory() );
2113 ((AllSettings*)this)->mpData->mpCollatorWrapper->loadDefaultCollator( GetLocale(), 0 );
2115 return *mpData->mpCollatorWrapper;
2118 // -----------------------------------------------------------------------
2120 const CollatorWrapper& AllSettings::GetUICollatorWrapper() const
2122 if ( !mpData->mpUICollatorWrapper )
2124 ((AllSettings*)this)->mpData->mpUICollatorWrapper = new CollatorWrapper( vcl::unohelper::GetMultiServiceFactory() );
2125 ((AllSettings*)this)->mpData->mpUICollatorWrapper->loadDefaultCollator( GetUILocale(), 0 );
2127 return *mpData->mpUICollatorWrapper;