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