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_svtools.hxx" 26 27 #include <svtools/accessibilityoptions.hxx> 28 #include "configitems/accessibilityoptions_const.hxx" 29 30 #include <unotools/configmgr.hxx> 31 #include <tools/debug.hxx> 32 #include <com/sun/star/uno/Any.hxx> 33 #include <com/sun/star/uno/Sequence.hxx> 34 35 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ 36 #include <com/sun/star/beans/XPropertySet.hpp> 37 #endif 38 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ 39 #include <com/sun/star/container/XNameAccess.hpp> 40 #endif 41 #ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ 42 #include <comphelper/configurationhelper.hxx> 43 #endif 44 #ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ 45 #include <unotools/processfactory.hxx> 46 #endif 47 #ifndef _SVT_LOGHELPER_HXX_ 48 #include <unotools/loghelper.hxx> 49 #endif 50 51 #include <svl/smplhint.hxx> 52 53 #include <vcl/settings.hxx> 54 #include <vcl/svapp.hxx> 55 #include <rtl/instance.hxx> 56 57 #include <itemholder2.hxx> 58 59 using namespace utl; 60 using namespace rtl; 61 using namespace com::sun::star::uno; 62 namespace css = com::sun::star; 63 64 #define HELP_TIP_TIMEOUT 0xffff // max. timeout setting to pretend a non-timeout 65 66 67 // class SvtAccessibilityOptions_Impl --------------------------------------------- 68 69 class SvtAccessibilityOptions_Impl 70 { 71 private: 72 css::uno::Reference< css::container::XNameAccess > m_xCfg; 73 sal_Bool bIsModified; 74 75 public: 76 SvtAccessibilityOptions_Impl(); 77 ~SvtAccessibilityOptions_Impl(); 78 79 void SetVCLSettings(); 80 sal_Bool GetAutoDetectSystemHC(); 81 sal_Bool GetIsForPagePreviews() const; 82 sal_Bool GetIsHelpTipsDisappear() const; 83 sal_Bool GetIsAllowAnimatedGraphics() const; 84 sal_Bool GetIsAllowAnimatedText() const; 85 sal_Bool GetIsAutomaticFontColor() const; 86 sal_Bool GetIsSystemFont() const; 87 sal_Int16 GetHelpTipSeconds() const; 88 sal_Bool IsSelectionInReadonly() const; 89 sal_Int16 GetEdgeBlending() const; 90 sal_Int16 GetListBoxMaximumLineCount() const; 91 sal_Int16 GetColorValueSetColumnCount() const; 92 sal_Bool GetPreviewUsesCheckeredBackground() const; 93 94 void SetAutoDetectSystemHC(sal_Bool bSet); 95 void SetIsForPagePreviews(sal_Bool bSet); 96 void SetIsHelpTipsDisappear(sal_Bool bSet); 97 void SetIsAllowAnimatedGraphics(sal_Bool bSet); 98 void SetIsAllowAnimatedText(sal_Bool bSet); 99 void SetIsAutomaticFontColor(sal_Bool bSet); 100 void SetIsSystemFont(sal_Bool bSet); 101 void SetHelpTipSeconds(sal_Int16 nSet); 102 void SetSelectionInReadonly(sal_Bool bSet); 103 void SetEdgeBlending(sal_Int16 nSet); 104 void SetListBoxMaximumLineCount(sal_Int16 nSet); 105 void SetColorValueSetColumnCount(sal_Int16 nSet); 106 void SetPreviewUsesCheckeredBackground(sal_Bool bSet); 107 108 sal_Bool IsModified() const { return bIsModified; }; 109 }; 110 111 // initialization of static members -------------------------------------- 112 113 SvtAccessibilityOptions_Impl* volatile SvtAccessibilityOptions::sm_pSingleImplConfig =NULL; 114 sal_Int32 volatile SvtAccessibilityOptions::sm_nAccessibilityRefCount(0); 115 116 namespace 117 { 118 struct SingletonMutex 119 : public rtl::Static< ::osl::Mutex, SingletonMutex > {}; 120 } 121 122 // ----------------------------------------------------------------------- 123 // class SvtAccessibilityOptions_Impl --------------------------------------------- 124 125 SvtAccessibilityOptions_Impl::SvtAccessibilityOptions_Impl() 126 { 127 try 128 { 129 m_xCfg = css::uno::Reference< css::container::XNameAccess >( 130 ::comphelper::ConfigurationHelper::openConfig( 131 utl::getProcessServiceFactory(), 132 s_sAccessibility, 133 ::comphelper::ConfigurationHelper::E_STANDARD), 134 css::uno::UNO_QUERY); 135 136 bIsModified = sal_False; 137 } 138 catch(const css::uno::Exception& ex) 139 { 140 m_xCfg.clear(); 141 LogHelper::logIt(ex); 142 } 143 } 144 145 SvtAccessibilityOptions_Impl::~SvtAccessibilityOptions_Impl() 146 { 147 } 148 149 // ----------------------------------------------------------------------- 150 sal_Bool SvtAccessibilityOptions_Impl::GetAutoDetectSystemHC() 151 { 152 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 153 sal_Bool bRet = sal_True; 154 155 try 156 { 157 if(xNode.is()) 158 xNode->getPropertyValue(s_sAutoDetectSystemHC) >>= bRet; 159 } 160 catch(const css::uno::Exception& ex) 161 { 162 LogHelper::logIt(ex); 163 } 164 165 return bRet; 166 } 167 168 sal_Bool SvtAccessibilityOptions_Impl::GetIsForPagePreviews() const 169 { 170 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 171 sal_Bool bRet = sal_True; 172 173 try 174 { 175 if(xNode.is()) 176 xNode->getPropertyValue(s_sIsForPagePreviews) >>= bRet; 177 } 178 catch(const css::uno::Exception& ex) 179 { 180 LogHelper::logIt(ex); 181 } 182 return bRet; 183 } 184 185 sal_Bool SvtAccessibilityOptions_Impl::GetIsHelpTipsDisappear() const 186 { 187 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 188 sal_Bool bRet = sal_True; 189 190 try 191 { 192 if(xNode.is()) 193 xNode->getPropertyValue(s_sIsHelpTipsDisappear) >>= bRet; 194 } 195 catch(const css::uno::Exception& ex) 196 { 197 LogHelper::logIt(ex); 198 } 199 200 return bRet; 201 } 202 203 sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedGraphics() const 204 { 205 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 206 sal_Bool bRet = sal_True; 207 208 try 209 { 210 if(xNode.is()) 211 xNode->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bRet; 212 } 213 catch(const css::uno::Exception& ex) 214 { 215 LogHelper::logIt(ex); 216 } 217 218 return bRet; 219 } 220 221 sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedText() const 222 { 223 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 224 sal_Bool bRet = sal_True; 225 226 try 227 { 228 if(xNode.is()) 229 xNode->getPropertyValue(s_sIsAllowAnimatedText) >>= bRet; 230 } 231 catch(const css::uno::Exception& ex) 232 { 233 LogHelper::logIt(ex); 234 } 235 236 return bRet; 237 } 238 239 sal_Bool SvtAccessibilityOptions_Impl::GetIsAutomaticFontColor() const 240 { 241 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 242 sal_Bool bRet = sal_False; 243 244 try 245 { 246 if(xNode.is()) 247 xNode->getPropertyValue(s_sIsAutomaticFontColor) >>= bRet; 248 } 249 catch(const css::uno::Exception& ex) 250 { 251 LogHelper::logIt(ex); 252 } 253 254 return bRet; 255 } 256 257 sal_Bool SvtAccessibilityOptions_Impl::GetIsSystemFont() const 258 { 259 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 260 sal_Bool bRet = sal_True; 261 262 try 263 { 264 if(xNode.is()) 265 xNode->getPropertyValue(s_sIsSystemFont) >>= bRet; 266 } 267 catch(const css::uno::Exception& ex) 268 { 269 LogHelper::logIt(ex); 270 } 271 272 return bRet; 273 } 274 275 sal_Int16 SvtAccessibilityOptions_Impl::GetHelpTipSeconds() const 276 { 277 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 278 sal_Int16 nRet = 4; 279 280 try 281 { 282 if(xNode.is()) 283 xNode->getPropertyValue(s_sHelpTipSeconds) >>= nRet; 284 } 285 catch(const css::uno::Exception& ex) 286 { 287 LogHelper::logIt(ex); 288 } 289 290 return nRet; 291 } 292 293 sal_Bool SvtAccessibilityOptions_Impl::IsSelectionInReadonly() const 294 { 295 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 296 sal_Bool bRet = sal_False; 297 298 try 299 { 300 if(xNode.is()) 301 xNode->getPropertyValue(s_sIsSelectionInReadonly) >>= bRet; 302 } 303 catch(const css::uno::Exception& ex) 304 { 305 LogHelper::logIt(ex); 306 } 307 308 return bRet; 309 } 310 311 sal_Int16 SvtAccessibilityOptions_Impl::GetEdgeBlending() const 312 { 313 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 314 sal_Int16 nRet = 35; 315 316 try 317 { 318 if(xNode.is()) 319 xNode->getPropertyValue(s_sEdgeBlending) >>= nRet; 320 } 321 catch(const css::uno::Exception& ex) 322 { 323 LogHelper::logIt(ex); 324 } 325 326 return nRet; 327 } 328 329 sal_Int16 SvtAccessibilityOptions_Impl::GetListBoxMaximumLineCount() const 330 { 331 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 332 sal_Int16 nRet = 25; 333 334 try 335 { 336 if(xNode.is()) 337 xNode->getPropertyValue(s_sListBoxMaximumLineCount) >>= nRet; 338 } 339 catch(const css::uno::Exception& ex) 340 { 341 LogHelper::logIt(ex); 342 } 343 344 return nRet; 345 } 346 347 sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const 348 { 349 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 350 sal_Int16 nRet = 12; 351 352 try 353 { 354 if(xNode.is()) 355 xNode->getPropertyValue(s_sColorValueSetColumnCount) >>= nRet; 356 } 357 catch(const css::uno::Exception& ex) 358 { 359 LogHelper::logIt(ex); 360 } 361 362 return nRet; 363 } 364 365 sal_Bool SvtAccessibilityOptions_Impl::GetPreviewUsesCheckeredBackground() const 366 { 367 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 368 sal_Bool bRet = sal_False; 369 370 try 371 { 372 if(xNode.is()) 373 xNode->getPropertyValue(s_sPreviewUsesCheckeredBackground) >>= bRet; 374 } 375 catch(const css::uno::Exception& ex) 376 { 377 LogHelper::logIt(ex); 378 } 379 380 return bRet; 381 } 382 383 void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet) 384 { 385 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 386 387 try 388 { 389 if(xNode.is() && xNode->getPropertyValue(s_sAutoDetectSystemHC)!=bSet) 390 { 391 xNode->setPropertyValue(s_sAutoDetectSystemHC, css::uno::makeAny(bSet)); 392 ::comphelper::ConfigurationHelper::flush(m_xCfg); 393 394 bIsModified = sal_True; 395 } 396 } 397 catch(const css::uno::Exception& ex) 398 { 399 LogHelper::logIt(ex); 400 } 401 } 402 403 void SvtAccessibilityOptions_Impl::SetIsForPagePreviews(sal_Bool bSet) 404 { 405 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 406 407 try 408 { 409 if(xNode.is() && xNode->getPropertyValue(s_sIsForPagePreviews)!=bSet) 410 { 411 xNode->setPropertyValue(s_sIsForPagePreviews, css::uno::makeAny(bSet)); 412 ::comphelper::ConfigurationHelper::flush(m_xCfg); 413 414 bIsModified = sal_True; 415 } 416 } 417 catch(const css::uno::Exception& ex) 418 { 419 LogHelper::logIt(ex); 420 } 421 } 422 423 void SvtAccessibilityOptions_Impl::SetIsHelpTipsDisappear(sal_Bool bSet) 424 { 425 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 426 427 try 428 { 429 if(xNode.is() && xNode->getPropertyValue(s_sIsHelpTipsDisappear)!=bSet) 430 { 431 xNode->setPropertyValue(s_sIsHelpTipsDisappear, css::uno::makeAny(bSet)); 432 ::comphelper::ConfigurationHelper::flush(m_xCfg); 433 434 bIsModified = sal_True; 435 } 436 } 437 catch(const css::uno::Exception& ex) 438 { 439 LogHelper::logIt(ex); 440 } 441 } 442 443 void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedGraphics(sal_Bool bSet) 444 { 445 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 446 447 try 448 { 449 if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedGraphics)!=bSet) 450 { 451 xNode->setPropertyValue(s_sIsAllowAnimatedGraphics, css::uno::makeAny(bSet)); 452 ::comphelper::ConfigurationHelper::flush(m_xCfg); 453 454 bIsModified = sal_True; 455 } 456 } 457 catch(const css::uno::Exception& ex) 458 { 459 LogHelper::logIt(ex); 460 } 461 } 462 463 void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedText(sal_Bool bSet) 464 { 465 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 466 467 try 468 { 469 if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedText)!=bSet) 470 { 471 xNode->setPropertyValue(s_sIsAllowAnimatedText, css::uno::makeAny(bSet)); 472 ::comphelper::ConfigurationHelper::flush(m_xCfg); 473 474 bIsModified = sal_True; 475 } 476 } 477 catch(const css::uno::Exception& ex) 478 { 479 LogHelper::logIt(ex); 480 } 481 } 482 483 void SvtAccessibilityOptions_Impl::SetIsAutomaticFontColor(sal_Bool bSet) 484 { 485 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 486 487 try 488 { 489 if(xNode.is() && xNode->getPropertyValue(s_sIsAutomaticFontColor)!=bSet) 490 { 491 xNode->setPropertyValue(s_sIsAutomaticFontColor, css::uno::makeAny(bSet)); 492 ::comphelper::ConfigurationHelper::flush(m_xCfg); 493 494 bIsModified = sal_True; 495 } 496 } 497 catch(const css::uno::Exception& ex) 498 { 499 LogHelper::logIt(ex); 500 } 501 } 502 503 void SvtAccessibilityOptions_Impl::SetIsSystemFont(sal_Bool bSet) 504 { 505 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 506 507 try 508 { 509 if(xNode.is() && xNode->getPropertyValue(s_sIsSystemFont)!=bSet) 510 { 511 xNode->setPropertyValue(s_sIsSystemFont, css::uno::makeAny(bSet)); 512 ::comphelper::ConfigurationHelper::flush(m_xCfg); 513 514 bIsModified = sal_True; 515 } 516 } 517 catch(const css::uno::Exception& ex) 518 { 519 LogHelper::logIt(ex); 520 } 521 } 522 523 void SvtAccessibilityOptions_Impl::SetHelpTipSeconds(sal_Int16 nSet) 524 { 525 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 526 527 try 528 { 529 if(xNode.is() && xNode->getPropertyValue(s_sHelpTipSeconds)!=nSet) 530 { 531 xNode->setPropertyValue(s_sHelpTipSeconds, css::uno::makeAny(nSet)); 532 ::comphelper::ConfigurationHelper::flush(m_xCfg); 533 534 bIsModified = sal_True; 535 } 536 } 537 catch(const css::uno::Exception& ex) 538 { 539 LogHelper::logIt(ex); 540 } 541 } 542 543 void SvtAccessibilityOptions_Impl::SetSelectionInReadonly(sal_Bool bSet) 544 { 545 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 546 547 try 548 { 549 if(xNode.is() && xNode->getPropertyValue(s_sIsSelectionInReadonly)!=bSet) 550 { 551 xNode->setPropertyValue(s_sIsSelectionInReadonly, css::uno::makeAny(bSet)); 552 ::comphelper::ConfigurationHelper::flush(m_xCfg); 553 554 bIsModified = sal_True; 555 } 556 } 557 catch(const css::uno::Exception& ex) 558 { 559 LogHelper::logIt(ex); 560 } 561 } 562 563 void SvtAccessibilityOptions_Impl::SetVCLSettings() 564 { 565 AllSettings aAllSettings(Application::GetSettings()); 566 StyleSettings aStyleSettings(aAllSettings.GetStyleSettings()); 567 HelpSettings aHelpSettings(aAllSettings.GetHelpSettings()); 568 bool StyleSettingsChanged(false); 569 570 aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT); 571 aAllSettings.SetHelpSettings(aHelpSettings); 572 573 if(aStyleSettings.GetUseSystemUIFonts() != GetIsSystemFont()) 574 { 575 aStyleSettings.SetUseSystemUIFonts(GetIsSystemFont()); 576 StyleSettingsChanged = true; 577 } 578 579 const sal_Int16 nEdgeBlendingCountA(GetEdgeBlending()); 580 OSL_ENSURE(nEdgeBlendingCountA >= 0, "OOps, negative values for EdgeBlending are not allowed (!)"); 581 const sal_uInt16 nEdgeBlendingCountB(static_cast< sal_uInt16 >(nEdgeBlendingCountA >= 0 ? nEdgeBlendingCountA : 0)); 582 583 if(aStyleSettings.GetEdgeBlending() != nEdgeBlendingCountB) 584 { 585 aStyleSettings.SetEdgeBlending(nEdgeBlendingCountB); 586 StyleSettingsChanged = true; 587 } 588 589 const sal_Int16 nMaxLineCountA(GetListBoxMaximumLineCount()); 590 OSL_ENSURE(nMaxLineCountA >= 0, "OOps, negative values for ListBoxMaximumLineCount are not allowed (!)"); 591 const sal_uInt16 nMaxLineCountB(static_cast< sal_uInt16 >(nMaxLineCountA >= 0 ? nMaxLineCountA : 0)); 592 593 if(aStyleSettings.GetListBoxMaximumLineCount() != nMaxLineCountB) 594 { 595 aStyleSettings.SetListBoxMaximumLineCount(nMaxLineCountB); 596 StyleSettingsChanged = true; 597 } 598 599 const sal_Int16 nMaxColumnCountA(GetColorValueSetColumnCount()); 600 OSL_ENSURE(nMaxColumnCountA >= 0, "OOps, negative values for ColorValueSetColumnCount are not allowed (!)"); 601 const sal_uInt16 nMaxColumnCountB(static_cast< sal_uInt16 >(nMaxColumnCountA >= 0 ? nMaxColumnCountA : 0)); 602 603 if(aStyleSettings.GetColorValueSetColumnCount() != nMaxColumnCountB) 604 { 605 aStyleSettings.SetColorValueSetColumnCount(nMaxColumnCountB); 606 StyleSettingsChanged = true; 607 } 608 609 const bool bPreviewUsesCheckeredBackground(GetPreviewUsesCheckeredBackground()); 610 611 if(aStyleSettings.GetPreviewUsesCheckeredBackground() != bPreviewUsesCheckeredBackground) 612 { 613 aStyleSettings.SetPreviewUsesCheckeredBackground(bPreviewUsesCheckeredBackground); 614 StyleSettingsChanged = true; 615 } 616 617 if(StyleSettingsChanged) 618 { 619 aAllSettings.SetStyleSettings(aStyleSettings); 620 Application::MergeSystemSettings(aAllSettings); 621 } 622 623 Application::SetSettings(aAllSettings); 624 } 625 626 void SvtAccessibilityOptions_Impl::SetEdgeBlending(sal_Int16 nSet) 627 { 628 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 629 630 try 631 { 632 if(xNode.is() && xNode->getPropertyValue(s_sEdgeBlending)!=nSet) 633 { 634 xNode->setPropertyValue(s_sEdgeBlending, css::uno::makeAny(nSet)); 635 ::comphelper::ConfigurationHelper::flush(m_xCfg); 636 637 bIsModified = sal_True; 638 } 639 } 640 catch(const css::uno::Exception& ex) 641 { 642 LogHelper::logIt(ex); 643 } 644 } 645 646 void SvtAccessibilityOptions_Impl::SetListBoxMaximumLineCount(sal_Int16 nSet) 647 { 648 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 649 650 try 651 { 652 if(xNode.is() && xNode->getPropertyValue(s_sListBoxMaximumLineCount)!=nSet) 653 { 654 xNode->setPropertyValue(s_sListBoxMaximumLineCount, css::uno::makeAny(nSet)); 655 ::comphelper::ConfigurationHelper::flush(m_xCfg); 656 657 bIsModified = sal_True; 658 } 659 } 660 catch(const css::uno::Exception& ex) 661 { 662 LogHelper::logIt(ex); 663 } 664 } 665 666 void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(sal_Int16 nSet) 667 { 668 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 669 670 try 671 { 672 if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetColumnCount)!=nSet) 673 { 674 xNode->setPropertyValue(s_sColorValueSetColumnCount, css::uno::makeAny(nSet)); 675 ::comphelper::ConfigurationHelper::flush(m_xCfg); 676 677 bIsModified = sal_True; 678 } 679 } 680 catch(const css::uno::Exception& ex) 681 { 682 LogHelper::logIt(ex); 683 } 684 } 685 686 void SvtAccessibilityOptions_Impl::SetPreviewUsesCheckeredBackground(sal_Bool bSet) 687 { 688 css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 689 690 try 691 { 692 if(xNode.is() && xNode->getPropertyValue(s_sPreviewUsesCheckeredBackground)!=bSet) 693 { 694 xNode->setPropertyValue(s_sPreviewUsesCheckeredBackground, css::uno::makeAny(bSet)); 695 ::comphelper::ConfigurationHelper::flush(m_xCfg); 696 697 bIsModified = sal_True; 698 } 699 } 700 catch(const css::uno::Exception& ex) 701 { 702 LogHelper::logIt(ex); 703 } 704 } 705 706 // ----------------------------------------------------------------------- 707 // class SvtAccessibilityOptions -------------------------------------------------- 708 709 SvtAccessibilityOptions::SvtAccessibilityOptions() 710 { 711 { 712 ::osl::MutexGuard aGuard( SingletonMutex::get() ); 713 if(!sm_pSingleImplConfig) 714 { 715 sm_pSingleImplConfig = new SvtAccessibilityOptions_Impl; 716 ItemHolder2::holdConfigItem(E_ACCESSIBILITYOPTIONS); 717 } 718 ++sm_nAccessibilityRefCount; 719 } 720 //StartListening( *sm_pSingleImplConfig, sal_True ); 721 } 722 723 // ----------------------------------------------------------------------- 724 725 SvtAccessibilityOptions::~SvtAccessibilityOptions() 726 { 727 //EndListening( *sm_pSingleImplConfig, sal_True ); 728 ::osl::MutexGuard aGuard( SingletonMutex::get() ); 729 if( !--sm_nAccessibilityRefCount ) 730 { 731 //if( sm_pSingleImplConfig->IsModified() ) 732 // sm_pSingleImplConfig->Commit(); 733 DELETEZ( sm_pSingleImplConfig ); 734 } 735 } 736 737 // ----------------------------------------------------------------------- 738 739 void SvtAccessibilityOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) 740 { 741 NotifyListeners(0); 742 if ( rHint.IsA(TYPE(SfxSimpleHint)) ) 743 { 744 if ( ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_ACCESSIBILITY_CHANGED ) 745 SetVCLSettings(); 746 } 747 } 748 749 // ----------------------------------------------------------------------- 750 751 sal_Bool SvtAccessibilityOptions::IsModified() const 752 { 753 return sm_pSingleImplConfig->IsModified(); 754 } 755 void SvtAccessibilityOptions::Commit() 756 { 757 //sm_pSingleImplConfig->Commit(); 758 } 759 760 // ----------------------------------------------------------------------- 761 762 sal_Bool SvtAccessibilityOptions::GetIsForDrawings() const 763 { 764 DBG_ERROR( "SvtAccessibilityOptions::GetIsForDrawings: is obsolete!" ); 765 return sal_False; 766 } 767 sal_Bool SvtAccessibilityOptions::GetIsForBorders() const 768 { 769 DBG_ERROR( "SvtAccessibilityOptions::GetIsForBorders: is obsolete!" ); 770 return sal_False; 771 } 772 sal_Bool SvtAccessibilityOptions::GetAutoDetectSystemHC() const 773 { 774 return sm_pSingleImplConfig->GetAutoDetectSystemHC(); 775 } 776 sal_Bool SvtAccessibilityOptions::GetIsForPagePreviews() const 777 { 778 return sm_pSingleImplConfig->GetIsForPagePreviews(); 779 } 780 sal_Bool SvtAccessibilityOptions::GetIsHelpTipsDisappear() const 781 { 782 return sm_pSingleImplConfig->GetIsHelpTipsDisappear(); 783 } 784 sal_Bool SvtAccessibilityOptions::GetIsAllowAnimatedGraphics() const 785 { 786 return sm_pSingleImplConfig->GetIsAllowAnimatedGraphics(); 787 } 788 sal_Bool SvtAccessibilityOptions::GetIsAllowAnimatedText() const 789 { 790 return sm_pSingleImplConfig->GetIsAllowAnimatedText(); 791 } 792 sal_Bool SvtAccessibilityOptions::GetIsAutomaticFontColor() const 793 { 794 return sm_pSingleImplConfig->GetIsAutomaticFontColor(); 795 } 796 sal_Bool SvtAccessibilityOptions::GetIsSystemFont() const 797 { 798 return sm_pSingleImplConfig->GetIsSystemFont(); 799 } 800 sal_Int16 SvtAccessibilityOptions::GetHelpTipSeconds() const 801 { 802 return sm_pSingleImplConfig->GetHelpTipSeconds(); 803 } 804 sal_Bool SvtAccessibilityOptions::IsSelectionInReadonly() const 805 { 806 return sm_pSingleImplConfig->IsSelectionInReadonly(); 807 } 808 sal_Int16 SvtAccessibilityOptions::GetEdgeBlending() const 809 { 810 return sm_pSingleImplConfig->GetEdgeBlending(); 811 } 812 sal_Int16 SvtAccessibilityOptions::GetListBoxMaximumLineCount() const 813 { 814 return sm_pSingleImplConfig->GetListBoxMaximumLineCount(); 815 } 816 sal_Int16 SvtAccessibilityOptions::GetColorValueSetColumnCount() const 817 { 818 return sm_pSingleImplConfig->GetColorValueSetColumnCount(); 819 } 820 sal_Bool SvtAccessibilityOptions::GetPreviewUsesCheckeredBackground() const 821 { 822 return sm_pSingleImplConfig->GetPreviewUsesCheckeredBackground(); 823 } 824 825 // ----------------------------------------------------------------------- 826 void SvtAccessibilityOptions::SetAutoDetectSystemHC(sal_Bool bSet) 827 { 828 sm_pSingleImplConfig->SetAutoDetectSystemHC(bSet); 829 } 830 void SvtAccessibilityOptions::SetIsForPagePreviews(sal_Bool bSet) 831 { 832 sm_pSingleImplConfig->SetIsForPagePreviews(bSet); 833 } 834 void SvtAccessibilityOptions::SetIsHelpTipsDisappear(sal_Bool bSet) 835 { 836 sm_pSingleImplConfig->SetIsHelpTipsDisappear(bSet); 837 } 838 void SvtAccessibilityOptions::SetIsAllowAnimatedGraphics(sal_Bool bSet) 839 { 840 sm_pSingleImplConfig->SetIsAllowAnimatedGraphics(bSet); 841 } 842 void SvtAccessibilityOptions::SetIsAllowAnimatedText(sal_Bool bSet) 843 { 844 sm_pSingleImplConfig->SetIsAllowAnimatedText(bSet); 845 } 846 void SvtAccessibilityOptions::SetIsAutomaticFontColor(sal_Bool bSet) 847 { 848 sm_pSingleImplConfig->SetIsAutomaticFontColor(bSet); 849 } 850 void SvtAccessibilityOptions::SetIsSystemFont(sal_Bool bSet) 851 { 852 sm_pSingleImplConfig->SetIsSystemFont(bSet); 853 } 854 void SvtAccessibilityOptions::SetHelpTipSeconds(sal_Int16 nSet) 855 { 856 sm_pSingleImplConfig->SetHelpTipSeconds(nSet); 857 } 858 void SvtAccessibilityOptions::SetSelectionInReadonly(sal_Bool bSet) 859 { 860 sm_pSingleImplConfig->SetSelectionInReadonly(bSet); 861 } 862 void SvtAccessibilityOptions::SetVCLSettings() 863 { 864 sm_pSingleImplConfig->SetVCLSettings(); 865 } 866 void SvtAccessibilityOptions::SetEdgeBlending(sal_Int16 nSet) 867 { 868 sm_pSingleImplConfig->SetEdgeBlending(nSet); 869 } 870 void SvtAccessibilityOptions::SetListBoxMaximumLineCount(sal_Int16 nSet) 871 { 872 sm_pSingleImplConfig->SetListBoxMaximumLineCount(nSet); 873 } 874 void SvtAccessibilityOptions::SetColorValueSetColumnCount(sal_Int16 nSet) 875 { 876 sm_pSingleImplConfig->SetColorValueSetColumnCount(nSet); 877 } 878 void SvtAccessibilityOptions::SetPreviewUsesCheckeredBackground(sal_Bool bSet) 879 { 880 sm_pSingleImplConfig->SetPreviewUsesCheckeredBackground(bSet); 881 } 882 883 // ----------------------------------------------------------------------- 884