1*5900e8ecSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5900e8ecSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5900e8ecSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5900e8ecSAndrew Rist * distributed with this work for additional information 6*5900e8ecSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5900e8ecSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5900e8ecSAndrew Rist * "License"); you may not use this file except in compliance 9*5900e8ecSAndrew Rist * with the License. You may obtain a copy of the License at 10*5900e8ecSAndrew Rist * 11*5900e8ecSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*5900e8ecSAndrew Rist * 13*5900e8ecSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5900e8ecSAndrew Rist * software distributed under the License is distributed on an 15*5900e8ecSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5900e8ecSAndrew Rist * KIND, either express or implied. See the License for the 17*5900e8ecSAndrew Rist * specific language governing permissions and limitations 18*5900e8ecSAndrew Rist * under the License. 19*5900e8ecSAndrew Rist * 20*5900e8ecSAndrew Rist *************************************************************/ 21*5900e8ecSAndrew Rist 22*5900e8ecSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svtools.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <svtools/accessibilityoptions.hxx> 28cdf0e10cSrcweir #include "configitems/accessibilityoptions_const.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <unotools/configmgr.hxx> 31cdf0e10cSrcweir #include <tools/debug.hxx> 32cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx> 33cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ 36cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ 39cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir #ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ 42cdf0e10cSrcweir #include <comphelper/configurationhelper.hxx> 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir #ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ 45cdf0e10cSrcweir #include <unotools/processfactory.hxx> 46cdf0e10cSrcweir #endif 47cdf0e10cSrcweir #ifndef _SVT_LOGHELPER_HXX_ 48cdf0e10cSrcweir #include <unotools/loghelper.hxx> 49cdf0e10cSrcweir #endif 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include <svl/smplhint.hxx> 52cdf0e10cSrcweir 53cdf0e10cSrcweir #include <vcl/settings.hxx> 54cdf0e10cSrcweir #include <vcl/svapp.hxx> 55cdf0e10cSrcweir #include <rtl/instance.hxx> 56cdf0e10cSrcweir 57cdf0e10cSrcweir #include <itemholder2.hxx> 58cdf0e10cSrcweir 59cdf0e10cSrcweir using namespace utl; 60cdf0e10cSrcweir using namespace rtl; 61cdf0e10cSrcweir using namespace com::sun::star::uno; 62cdf0e10cSrcweir namespace css = com::sun::star; 63cdf0e10cSrcweir 64cdf0e10cSrcweir #define HELP_TIP_TIMEOUT 0xffff // max. timeout setting to pretend a non-timeout 65cdf0e10cSrcweir 66cdf0e10cSrcweir 67cdf0e10cSrcweir // class SvtAccessibilityOptions_Impl --------------------------------------------- 68cdf0e10cSrcweir 69cdf0e10cSrcweir class SvtAccessibilityOptions_Impl 70cdf0e10cSrcweir { 71cdf0e10cSrcweir private: 72cdf0e10cSrcweir css::uno::Reference< css::container::XNameAccess > m_xCfg; 73cdf0e10cSrcweir sal_Bool bIsModified; 74cdf0e10cSrcweir 75cdf0e10cSrcweir public: 76cdf0e10cSrcweir SvtAccessibilityOptions_Impl(); 77cdf0e10cSrcweir ~SvtAccessibilityOptions_Impl(); 78cdf0e10cSrcweir 79cdf0e10cSrcweir void SetVCLSettings(); 80cdf0e10cSrcweir sal_Bool GetAutoDetectSystemHC(); 81cdf0e10cSrcweir sal_Bool GetIsForPagePreviews() const; 82cdf0e10cSrcweir sal_Bool GetIsHelpTipsDisappear() const; 83cdf0e10cSrcweir sal_Bool GetIsAllowAnimatedGraphics() const; 84cdf0e10cSrcweir sal_Bool GetIsAllowAnimatedText() const; 85cdf0e10cSrcweir sal_Bool GetIsAutomaticFontColor() const; 86cdf0e10cSrcweir sal_Bool GetIsSystemFont() const; 87cdf0e10cSrcweir sal_Int16 GetHelpTipSeconds() const; 88cdf0e10cSrcweir sal_Bool IsSelectionInReadonly() const; 89cdf0e10cSrcweir 90cdf0e10cSrcweir void SetAutoDetectSystemHC(sal_Bool bSet); 91cdf0e10cSrcweir void SetIsForPagePreviews(sal_Bool bSet); 92cdf0e10cSrcweir void SetIsHelpTipsDisappear(sal_Bool bSet); 93cdf0e10cSrcweir void SetIsAllowAnimatedGraphics(sal_Bool bSet); 94cdf0e10cSrcweir void SetIsAllowAnimatedText(sal_Bool bSet); 95cdf0e10cSrcweir void SetIsAutomaticFontColor(sal_Bool bSet); 96cdf0e10cSrcweir void SetIsSystemFont(sal_Bool bSet); 97cdf0e10cSrcweir void SetHelpTipSeconds(sal_Int16 nSet); 98cdf0e10cSrcweir void SetSelectionInReadonly(sal_Bool bSet); 99cdf0e10cSrcweir 100cdf0e10cSrcweir sal_Bool IsModified() const { return bIsModified; }; 101cdf0e10cSrcweir }; 102cdf0e10cSrcweir 103cdf0e10cSrcweir // initialization of static members -------------------------------------- 104cdf0e10cSrcweir 105cdf0e10cSrcweir SvtAccessibilityOptions_Impl* volatile SvtAccessibilityOptions::sm_pSingleImplConfig =NULL; 106cdf0e10cSrcweir sal_Int32 volatile SvtAccessibilityOptions::sm_nAccessibilityRefCount(0); 107cdf0e10cSrcweir 108cdf0e10cSrcweir namespace 109cdf0e10cSrcweir { 110cdf0e10cSrcweir struct SingletonMutex 111cdf0e10cSrcweir : public rtl::Static< ::osl::Mutex, SingletonMutex > {}; 112cdf0e10cSrcweir } 113cdf0e10cSrcweir 114cdf0e10cSrcweir // ----------------------------------------------------------------------- 115cdf0e10cSrcweir // class SvtAccessibilityOptions_Impl --------------------------------------------- 116cdf0e10cSrcweir 117cdf0e10cSrcweir SvtAccessibilityOptions_Impl::SvtAccessibilityOptions_Impl() 118cdf0e10cSrcweir { 119cdf0e10cSrcweir try 120cdf0e10cSrcweir { 121cdf0e10cSrcweir m_xCfg = css::uno::Reference< css::container::XNameAccess >( 122cdf0e10cSrcweir ::comphelper::ConfigurationHelper::openConfig( 123cdf0e10cSrcweir utl::getProcessServiceFactory(), 124cdf0e10cSrcweir s_sAccessibility, 125cdf0e10cSrcweir ::comphelper::ConfigurationHelper::E_STANDARD), 126cdf0e10cSrcweir css::uno::UNO_QUERY); 127cdf0e10cSrcweir 128cdf0e10cSrcweir bIsModified = sal_False; 129cdf0e10cSrcweir } 130cdf0e10cSrcweir catch(const css::uno::Exception& ex) 131cdf0e10cSrcweir { 132cdf0e10cSrcweir m_xCfg.clear(); 133cdf0e10cSrcweir LogHelper::logIt(ex); 134cdf0e10cSrcweir } 135cdf0e10cSrcweir } 136cdf0e10cSrcweir 137cdf0e10cSrcweir SvtAccessibilityOptions_Impl::~SvtAccessibilityOptions_Impl() 138cdf0e10cSrcweir { 139cdf0e10cSrcweir } 140cdf0e10cSrcweir 141cdf0e10cSrcweir // ----------------------------------------------------------------------- 142cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions_Impl::GetAutoDetectSystemHC() 143cdf0e10cSrcweir { 144cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 145cdf0e10cSrcweir sal_Bool bRet = sal_True; 146cdf0e10cSrcweir 147cdf0e10cSrcweir try 148cdf0e10cSrcweir { 149cdf0e10cSrcweir if(xNode.is()) 150cdf0e10cSrcweir xNode->getPropertyValue(s_sAutoDetectSystemHC) >>= bRet; 151cdf0e10cSrcweir } 152cdf0e10cSrcweir catch(const css::uno::Exception& ex) 153cdf0e10cSrcweir { 154cdf0e10cSrcweir LogHelper::logIt(ex); 155cdf0e10cSrcweir } 156cdf0e10cSrcweir 157cdf0e10cSrcweir return bRet; 158cdf0e10cSrcweir } 159cdf0e10cSrcweir 160cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions_Impl::GetIsForPagePreviews() const 161cdf0e10cSrcweir { 162cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 163cdf0e10cSrcweir sal_Bool bRet = sal_True; 164cdf0e10cSrcweir 165cdf0e10cSrcweir try 166cdf0e10cSrcweir { 167cdf0e10cSrcweir if(xNode.is()) 168cdf0e10cSrcweir xNode->getPropertyValue(s_sIsForPagePreviews) >>= bRet; 169cdf0e10cSrcweir } 170cdf0e10cSrcweir catch(const css::uno::Exception& ex) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir LogHelper::logIt(ex); 173cdf0e10cSrcweir } 174cdf0e10cSrcweir return bRet; 175cdf0e10cSrcweir } 176cdf0e10cSrcweir 177cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions_Impl::GetIsHelpTipsDisappear() const 178cdf0e10cSrcweir { 179cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 180cdf0e10cSrcweir sal_Bool bRet = sal_True; 181cdf0e10cSrcweir 182cdf0e10cSrcweir try 183cdf0e10cSrcweir { 184cdf0e10cSrcweir if(xNode.is()) 185cdf0e10cSrcweir xNode->getPropertyValue(s_sIsHelpTipsDisappear) >>= bRet; 186cdf0e10cSrcweir } 187cdf0e10cSrcweir catch(const css::uno::Exception& ex) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir LogHelper::logIt(ex); 190cdf0e10cSrcweir } 191cdf0e10cSrcweir 192cdf0e10cSrcweir return bRet; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedGraphics() const 196cdf0e10cSrcweir { 197cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 198cdf0e10cSrcweir sal_Bool bRet = sal_True; 199cdf0e10cSrcweir 200cdf0e10cSrcweir try 201cdf0e10cSrcweir { 202cdf0e10cSrcweir if(xNode.is()) 203cdf0e10cSrcweir xNode->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bRet; 204cdf0e10cSrcweir } 205cdf0e10cSrcweir catch(const css::uno::Exception& ex) 206cdf0e10cSrcweir { 207cdf0e10cSrcweir LogHelper::logIt(ex); 208cdf0e10cSrcweir } 209cdf0e10cSrcweir 210cdf0e10cSrcweir return bRet; 211cdf0e10cSrcweir } 212cdf0e10cSrcweir 213cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedText() const 214cdf0e10cSrcweir { 215cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 216cdf0e10cSrcweir sal_Bool bRet = sal_True; 217cdf0e10cSrcweir 218cdf0e10cSrcweir try 219cdf0e10cSrcweir { 220cdf0e10cSrcweir if(xNode.is()) 221cdf0e10cSrcweir xNode->getPropertyValue(s_sIsAllowAnimatedText) >>= bRet; 222cdf0e10cSrcweir } 223cdf0e10cSrcweir catch(const css::uno::Exception& ex) 224cdf0e10cSrcweir { 225cdf0e10cSrcweir LogHelper::logIt(ex); 226cdf0e10cSrcweir } 227cdf0e10cSrcweir 228cdf0e10cSrcweir return bRet; 229cdf0e10cSrcweir } 230cdf0e10cSrcweir 231cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions_Impl::GetIsAutomaticFontColor() const 232cdf0e10cSrcweir { 233cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 234cdf0e10cSrcweir sal_Bool bRet = sal_False; 235cdf0e10cSrcweir 236cdf0e10cSrcweir try 237cdf0e10cSrcweir { 238cdf0e10cSrcweir if(xNode.is()) 239cdf0e10cSrcweir xNode->getPropertyValue(s_sIsAutomaticFontColor) >>= bRet; 240cdf0e10cSrcweir } 241cdf0e10cSrcweir catch(const css::uno::Exception& ex) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir LogHelper::logIt(ex); 244cdf0e10cSrcweir } 245cdf0e10cSrcweir 246cdf0e10cSrcweir return bRet; 247cdf0e10cSrcweir } 248cdf0e10cSrcweir 249cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions_Impl::GetIsSystemFont() const 250cdf0e10cSrcweir { 251cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 252cdf0e10cSrcweir sal_Bool bRet = sal_True; 253cdf0e10cSrcweir 254cdf0e10cSrcweir try 255cdf0e10cSrcweir { 256cdf0e10cSrcweir if(xNode.is()) 257cdf0e10cSrcweir xNode->getPropertyValue(s_sIsSystemFont) >>= bRet; 258cdf0e10cSrcweir } 259cdf0e10cSrcweir catch(const css::uno::Exception& ex) 260cdf0e10cSrcweir { 261cdf0e10cSrcweir LogHelper::logIt(ex); 262cdf0e10cSrcweir } 263cdf0e10cSrcweir 264cdf0e10cSrcweir return bRet; 265cdf0e10cSrcweir } 266cdf0e10cSrcweir 267cdf0e10cSrcweir sal_Int16 SvtAccessibilityOptions_Impl::GetHelpTipSeconds() const 268cdf0e10cSrcweir { 269cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 270cdf0e10cSrcweir sal_Int16 nRet = 4; 271cdf0e10cSrcweir 272cdf0e10cSrcweir try 273cdf0e10cSrcweir { 274cdf0e10cSrcweir if(xNode.is()) 275cdf0e10cSrcweir xNode->getPropertyValue(s_sHelpTipSeconds) >>= nRet; 276cdf0e10cSrcweir } 277cdf0e10cSrcweir catch(const css::uno::Exception& ex) 278cdf0e10cSrcweir { 279cdf0e10cSrcweir LogHelper::logIt(ex); 280cdf0e10cSrcweir } 281cdf0e10cSrcweir 282cdf0e10cSrcweir return nRet; 283cdf0e10cSrcweir } 284cdf0e10cSrcweir 285cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions_Impl::IsSelectionInReadonly() const 286cdf0e10cSrcweir { 287cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 288cdf0e10cSrcweir sal_Bool bRet = sal_False; 289cdf0e10cSrcweir 290cdf0e10cSrcweir try 291cdf0e10cSrcweir { 292cdf0e10cSrcweir if(xNode.is()) 293cdf0e10cSrcweir xNode->getPropertyValue(s_sIsSelectionInReadonly) >>= bRet; 294cdf0e10cSrcweir } 295cdf0e10cSrcweir catch(const css::uno::Exception& ex) 296cdf0e10cSrcweir { 297cdf0e10cSrcweir LogHelper::logIt(ex); 298cdf0e10cSrcweir } 299cdf0e10cSrcweir 300cdf0e10cSrcweir return bRet; 301cdf0e10cSrcweir } 302cdf0e10cSrcweir 303cdf0e10cSrcweir void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 306cdf0e10cSrcweir 307cdf0e10cSrcweir try 308cdf0e10cSrcweir { 309cdf0e10cSrcweir if(xNode.is() && xNode->getPropertyValue(s_sAutoDetectSystemHC)!=bSet) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir xNode->setPropertyValue(s_sAutoDetectSystemHC, css::uno::makeAny(bSet)); 312cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCfg); 313cdf0e10cSrcweir 314cdf0e10cSrcweir bIsModified = sal_True; 315cdf0e10cSrcweir } 316cdf0e10cSrcweir } 317cdf0e10cSrcweir catch(const css::uno::Exception& ex) 318cdf0e10cSrcweir { 319cdf0e10cSrcweir LogHelper::logIt(ex); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir } 322cdf0e10cSrcweir 323cdf0e10cSrcweir void SvtAccessibilityOptions_Impl::SetIsForPagePreviews(sal_Bool bSet) 324cdf0e10cSrcweir { 325cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 326cdf0e10cSrcweir 327cdf0e10cSrcweir try 328cdf0e10cSrcweir { 329cdf0e10cSrcweir if(xNode.is() && xNode->getPropertyValue(s_sIsForPagePreviews)!=bSet) 330cdf0e10cSrcweir { 331cdf0e10cSrcweir xNode->setPropertyValue(s_sIsForPagePreviews, css::uno::makeAny(bSet)); 332cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCfg); 333cdf0e10cSrcweir 334cdf0e10cSrcweir bIsModified = sal_True; 335cdf0e10cSrcweir } 336cdf0e10cSrcweir } 337cdf0e10cSrcweir catch(const css::uno::Exception& ex) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir LogHelper::logIt(ex); 340cdf0e10cSrcweir } 341cdf0e10cSrcweir } 342cdf0e10cSrcweir 343cdf0e10cSrcweir void SvtAccessibilityOptions_Impl::SetIsHelpTipsDisappear(sal_Bool bSet) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 346cdf0e10cSrcweir 347cdf0e10cSrcweir try 348cdf0e10cSrcweir { 349cdf0e10cSrcweir if(xNode.is() && xNode->getPropertyValue(s_sIsHelpTipsDisappear)!=bSet) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir xNode->setPropertyValue(s_sIsHelpTipsDisappear, css::uno::makeAny(bSet)); 352cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCfg); 353cdf0e10cSrcweir 354cdf0e10cSrcweir bIsModified = sal_True; 355cdf0e10cSrcweir } 356cdf0e10cSrcweir } 357cdf0e10cSrcweir catch(const css::uno::Exception& ex) 358cdf0e10cSrcweir { 359cdf0e10cSrcweir LogHelper::logIt(ex); 360cdf0e10cSrcweir } 361cdf0e10cSrcweir } 362cdf0e10cSrcweir 363cdf0e10cSrcweir void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedGraphics(sal_Bool bSet) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 366cdf0e10cSrcweir 367cdf0e10cSrcweir try 368cdf0e10cSrcweir { 369cdf0e10cSrcweir if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedGraphics)!=bSet) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir xNode->setPropertyValue(s_sIsAllowAnimatedGraphics, css::uno::makeAny(bSet)); 372cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCfg); 373cdf0e10cSrcweir 374cdf0e10cSrcweir bIsModified = sal_True; 375cdf0e10cSrcweir } 376cdf0e10cSrcweir } 377cdf0e10cSrcweir catch(const css::uno::Exception& ex) 378cdf0e10cSrcweir { 379cdf0e10cSrcweir LogHelper::logIt(ex); 380cdf0e10cSrcweir } 381cdf0e10cSrcweir } 382cdf0e10cSrcweir 383cdf0e10cSrcweir void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedText(sal_Bool bSet) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 386cdf0e10cSrcweir 387cdf0e10cSrcweir try 388cdf0e10cSrcweir { 389cdf0e10cSrcweir if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedText)!=bSet) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir xNode->setPropertyValue(s_sIsAllowAnimatedText, css::uno::makeAny(bSet)); 392cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCfg); 393cdf0e10cSrcweir 394cdf0e10cSrcweir bIsModified = sal_True; 395cdf0e10cSrcweir } 396cdf0e10cSrcweir } 397cdf0e10cSrcweir catch(const css::uno::Exception& ex) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir LogHelper::logIt(ex); 400cdf0e10cSrcweir } 401cdf0e10cSrcweir } 402cdf0e10cSrcweir 403cdf0e10cSrcweir void SvtAccessibilityOptions_Impl::SetIsAutomaticFontColor(sal_Bool bSet) 404cdf0e10cSrcweir { 405cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 406cdf0e10cSrcweir 407cdf0e10cSrcweir try 408cdf0e10cSrcweir { 409cdf0e10cSrcweir if(xNode.is() && xNode->getPropertyValue(s_sIsAutomaticFontColor)!=bSet) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir xNode->setPropertyValue(s_sIsAutomaticFontColor, css::uno::makeAny(bSet)); 412cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCfg); 413cdf0e10cSrcweir 414cdf0e10cSrcweir bIsModified = sal_True; 415cdf0e10cSrcweir } 416cdf0e10cSrcweir } 417cdf0e10cSrcweir catch(const css::uno::Exception& ex) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir LogHelper::logIt(ex); 420cdf0e10cSrcweir } 421cdf0e10cSrcweir } 422cdf0e10cSrcweir 423cdf0e10cSrcweir void SvtAccessibilityOptions_Impl::SetIsSystemFont(sal_Bool bSet) 424cdf0e10cSrcweir { 425cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 426cdf0e10cSrcweir 427cdf0e10cSrcweir try 428cdf0e10cSrcweir { 429cdf0e10cSrcweir if(xNode.is() && xNode->getPropertyValue(s_sIsSystemFont)!=bSet) 430cdf0e10cSrcweir { 431cdf0e10cSrcweir xNode->setPropertyValue(s_sIsSystemFont, css::uno::makeAny(bSet)); 432cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCfg); 433cdf0e10cSrcweir 434cdf0e10cSrcweir bIsModified = sal_True; 435cdf0e10cSrcweir } 436cdf0e10cSrcweir } 437cdf0e10cSrcweir catch(const css::uno::Exception& ex) 438cdf0e10cSrcweir { 439cdf0e10cSrcweir LogHelper::logIt(ex); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir void SvtAccessibilityOptions_Impl::SetHelpTipSeconds(sal_Int16 nSet) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 446cdf0e10cSrcweir 447cdf0e10cSrcweir try 448cdf0e10cSrcweir { 449cdf0e10cSrcweir if(xNode.is() && xNode->getPropertyValue(s_sHelpTipSeconds)!=nSet) 450cdf0e10cSrcweir { 451cdf0e10cSrcweir xNode->setPropertyValue(s_sHelpTipSeconds, css::uno::makeAny(nSet)); 452cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCfg); 453cdf0e10cSrcweir 454cdf0e10cSrcweir bIsModified = sal_True; 455cdf0e10cSrcweir } 456cdf0e10cSrcweir } 457cdf0e10cSrcweir catch(const css::uno::Exception& ex) 458cdf0e10cSrcweir { 459cdf0e10cSrcweir LogHelper::logIt(ex); 460cdf0e10cSrcweir } 461cdf0e10cSrcweir } 462cdf0e10cSrcweir 463cdf0e10cSrcweir void SvtAccessibilityOptions_Impl::SetSelectionInReadonly(sal_Bool bSet) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); 466cdf0e10cSrcweir 467cdf0e10cSrcweir try 468cdf0e10cSrcweir { 469cdf0e10cSrcweir if(xNode.is() && xNode->getPropertyValue(s_sIsSelectionInReadonly)!=bSet) 470cdf0e10cSrcweir { 471cdf0e10cSrcweir xNode->setPropertyValue(s_sIsSelectionInReadonly, css::uno::makeAny(bSet)); 472cdf0e10cSrcweir ::comphelper::ConfigurationHelper::flush(m_xCfg); 473cdf0e10cSrcweir 474cdf0e10cSrcweir bIsModified = sal_True; 475cdf0e10cSrcweir } 476cdf0e10cSrcweir } 477cdf0e10cSrcweir catch(const css::uno::Exception& ex) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir LogHelper::logIt(ex); 480cdf0e10cSrcweir } 481cdf0e10cSrcweir } 482cdf0e10cSrcweir 483cdf0e10cSrcweir void SvtAccessibilityOptions_Impl::SetVCLSettings() 484cdf0e10cSrcweir { 485cdf0e10cSrcweir AllSettings aAllSettings = Application::GetSettings(); 486cdf0e10cSrcweir HelpSettings aHelpSettings = aAllSettings.GetHelpSettings(); 487cdf0e10cSrcweir aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT); 488cdf0e10cSrcweir aAllSettings.SetHelpSettings(aHelpSettings); 489cdf0e10cSrcweir if(aAllSettings.GetStyleSettings().GetUseSystemUIFonts() != GetIsSystemFont() ) 490cdf0e10cSrcweir { 491cdf0e10cSrcweir StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); 492cdf0e10cSrcweir aStyleSettings.SetUseSystemUIFonts( GetIsSystemFont() ); 493cdf0e10cSrcweir aAllSettings.SetStyleSettings(aStyleSettings); 494cdf0e10cSrcweir Application::MergeSystemSettings( aAllSettings ); 495cdf0e10cSrcweir } 496cdf0e10cSrcweir 497cdf0e10cSrcweir Application::SetSettings(aAllSettings); 498cdf0e10cSrcweir } 499cdf0e10cSrcweir 500cdf0e10cSrcweir // ----------------------------------------------------------------------- 501cdf0e10cSrcweir // class SvtAccessibilityOptions -------------------------------------------------- 502cdf0e10cSrcweir 503cdf0e10cSrcweir SvtAccessibilityOptions::SvtAccessibilityOptions() 504cdf0e10cSrcweir { 505cdf0e10cSrcweir { 506cdf0e10cSrcweir ::osl::MutexGuard aGuard( SingletonMutex::get() ); 507cdf0e10cSrcweir if(!sm_pSingleImplConfig) 508cdf0e10cSrcweir { 509cdf0e10cSrcweir sm_pSingleImplConfig = new SvtAccessibilityOptions_Impl; 510cdf0e10cSrcweir ItemHolder2::holdConfigItem(E_ACCESSIBILITYOPTIONS); 511cdf0e10cSrcweir } 512cdf0e10cSrcweir ++sm_nAccessibilityRefCount; 513cdf0e10cSrcweir } 514cdf0e10cSrcweir //StartListening( *sm_pSingleImplConfig, sal_True ); 515cdf0e10cSrcweir } 516cdf0e10cSrcweir 517cdf0e10cSrcweir // ----------------------------------------------------------------------- 518cdf0e10cSrcweir 519cdf0e10cSrcweir SvtAccessibilityOptions::~SvtAccessibilityOptions() 520cdf0e10cSrcweir { 521cdf0e10cSrcweir //EndListening( *sm_pSingleImplConfig, sal_True ); 522cdf0e10cSrcweir ::osl::MutexGuard aGuard( SingletonMutex::get() ); 523cdf0e10cSrcweir if( !--sm_nAccessibilityRefCount ) 524cdf0e10cSrcweir { 525cdf0e10cSrcweir //if( sm_pSingleImplConfig->IsModified() ) 526cdf0e10cSrcweir // sm_pSingleImplConfig->Commit(); 527cdf0e10cSrcweir DELETEZ( sm_pSingleImplConfig ); 528cdf0e10cSrcweir } 529cdf0e10cSrcweir } 530cdf0e10cSrcweir 531cdf0e10cSrcweir // ----------------------------------------------------------------------- 532cdf0e10cSrcweir 533cdf0e10cSrcweir void SvtAccessibilityOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) 534cdf0e10cSrcweir { 535cdf0e10cSrcweir NotifyListeners(0); 536cdf0e10cSrcweir if ( rHint.IsA(TYPE(SfxSimpleHint)) ) 537cdf0e10cSrcweir { 538cdf0e10cSrcweir if ( ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_ACCESSIBILITY_CHANGED ) 539cdf0e10cSrcweir SetVCLSettings(); 540cdf0e10cSrcweir } 541cdf0e10cSrcweir } 542cdf0e10cSrcweir 543cdf0e10cSrcweir // ----------------------------------------------------------------------- 544cdf0e10cSrcweir 545cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::IsModified() const 546cdf0e10cSrcweir { 547cdf0e10cSrcweir return sm_pSingleImplConfig->IsModified(); 548cdf0e10cSrcweir } 549cdf0e10cSrcweir void SvtAccessibilityOptions::Commit() 550cdf0e10cSrcweir { 551cdf0e10cSrcweir //sm_pSingleImplConfig->Commit(); 552cdf0e10cSrcweir } 553cdf0e10cSrcweir 554cdf0e10cSrcweir // ----------------------------------------------------------------------- 555cdf0e10cSrcweir 556cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::GetIsForDrawings() const 557cdf0e10cSrcweir { 558cdf0e10cSrcweir DBG_ERROR( "SvtAccessibilityOptions::GetIsForDrawings: is obsolete!" ); 559cdf0e10cSrcweir return sal_False; 560cdf0e10cSrcweir } 561cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::GetIsForBorders() const 562cdf0e10cSrcweir { 563cdf0e10cSrcweir DBG_ERROR( "SvtAccessibilityOptions::GetIsForBorders: is obsolete!" ); 564cdf0e10cSrcweir return sal_False; 565cdf0e10cSrcweir } 566cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::GetAutoDetectSystemHC() const 567cdf0e10cSrcweir { 568cdf0e10cSrcweir return sm_pSingleImplConfig->GetAutoDetectSystemHC(); 569cdf0e10cSrcweir } 570cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::GetIsForPagePreviews() const 571cdf0e10cSrcweir { 572cdf0e10cSrcweir return sm_pSingleImplConfig->GetIsForPagePreviews(); 573cdf0e10cSrcweir } 574cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::GetIsHelpTipsDisappear() const 575cdf0e10cSrcweir { 576cdf0e10cSrcweir return sm_pSingleImplConfig->GetIsHelpTipsDisappear(); 577cdf0e10cSrcweir } 578cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::GetIsAllowAnimatedGraphics() const 579cdf0e10cSrcweir { 580cdf0e10cSrcweir return sm_pSingleImplConfig->GetIsAllowAnimatedGraphics(); 581cdf0e10cSrcweir } 582cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::GetIsAllowAnimatedText() const 583cdf0e10cSrcweir { 584cdf0e10cSrcweir return sm_pSingleImplConfig->GetIsAllowAnimatedText(); 585cdf0e10cSrcweir } 586cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::GetIsAutomaticFontColor() const 587cdf0e10cSrcweir { 588cdf0e10cSrcweir return sm_pSingleImplConfig->GetIsAutomaticFontColor(); 589cdf0e10cSrcweir } 590cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::GetIsSystemFont() const 591cdf0e10cSrcweir { 592cdf0e10cSrcweir return sm_pSingleImplConfig->GetIsSystemFont(); 593cdf0e10cSrcweir } 594cdf0e10cSrcweir sal_Int16 SvtAccessibilityOptions::GetHelpTipSeconds() const 595cdf0e10cSrcweir { 596cdf0e10cSrcweir return sm_pSingleImplConfig->GetHelpTipSeconds(); 597cdf0e10cSrcweir } 598cdf0e10cSrcweir sal_Bool SvtAccessibilityOptions::IsSelectionInReadonly() const 599cdf0e10cSrcweir { 600cdf0e10cSrcweir return sm_pSingleImplConfig->IsSelectionInReadonly(); 601cdf0e10cSrcweir } 602cdf0e10cSrcweir 603cdf0e10cSrcweir // ----------------------------------------------------------------------- 604cdf0e10cSrcweir void SvtAccessibilityOptions::SetAutoDetectSystemHC(sal_Bool bSet) 605cdf0e10cSrcweir { 606cdf0e10cSrcweir sm_pSingleImplConfig->SetAutoDetectSystemHC(bSet); 607cdf0e10cSrcweir } 608cdf0e10cSrcweir void SvtAccessibilityOptions::SetIsForPagePreviews(sal_Bool bSet) 609cdf0e10cSrcweir { 610cdf0e10cSrcweir sm_pSingleImplConfig->SetIsForPagePreviews(bSet); 611cdf0e10cSrcweir } 612cdf0e10cSrcweir void SvtAccessibilityOptions::SetIsHelpTipsDisappear(sal_Bool bSet) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir sm_pSingleImplConfig->SetIsHelpTipsDisappear(bSet); 615cdf0e10cSrcweir } 616cdf0e10cSrcweir void SvtAccessibilityOptions::SetIsAllowAnimatedGraphics(sal_Bool bSet) 617cdf0e10cSrcweir { 618cdf0e10cSrcweir sm_pSingleImplConfig->SetIsAllowAnimatedGraphics(bSet); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir void SvtAccessibilityOptions::SetIsAllowAnimatedText(sal_Bool bSet) 621cdf0e10cSrcweir { 622cdf0e10cSrcweir sm_pSingleImplConfig->SetIsAllowAnimatedText(bSet); 623cdf0e10cSrcweir } 624cdf0e10cSrcweir void SvtAccessibilityOptions::SetIsAutomaticFontColor(sal_Bool bSet) 625cdf0e10cSrcweir { 626cdf0e10cSrcweir sm_pSingleImplConfig->SetIsAutomaticFontColor(bSet); 627cdf0e10cSrcweir } 628cdf0e10cSrcweir void SvtAccessibilityOptions::SetIsSystemFont(sal_Bool bSet) 629cdf0e10cSrcweir { 630cdf0e10cSrcweir sm_pSingleImplConfig->SetIsSystemFont(bSet); 631cdf0e10cSrcweir } 632cdf0e10cSrcweir void SvtAccessibilityOptions::SetHelpTipSeconds(sal_Int16 nSet) 633cdf0e10cSrcweir { 634cdf0e10cSrcweir sm_pSingleImplConfig->SetHelpTipSeconds(nSet); 635cdf0e10cSrcweir } 636cdf0e10cSrcweir void SvtAccessibilityOptions::SetSelectionInReadonly(sal_Bool bSet) 637cdf0e10cSrcweir { 638cdf0e10cSrcweir sm_pSingleImplConfig->SetSelectionInReadonly(bSet); 639cdf0e10cSrcweir } 640cdf0e10cSrcweir 641cdf0e10cSrcweir void SvtAccessibilityOptions::SetVCLSettings() 642cdf0e10cSrcweir { 643cdf0e10cSrcweir sm_pSingleImplConfig->SetVCLSettings(); 644cdf0e10cSrcweir } 645cdf0e10cSrcweir // ----------------------------------------------------------------------- 646