LCOV - code coverage report
Current view: top level - libreoffice/vcl/source/app - settings.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 620 730 84.9 %
Date: 2012-12-17 Functions: 60 70 85.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10