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