LCOV - code coverage report
Current view: top level - svtools/source/config - accessibilityoptions.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 120 263 45.6 %
Date: 2015-06-13 12:38:46 Functions: 23 46 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <svtools/accessibilityoptions.hxx>
      22             : 
      23             : #include <unotools/configmgr.hxx>
      24             : #include <com/sun/star/uno/Any.hxx>
      25             : #include <com/sun/star/uno/Sequence.hxx>
      26             : 
      27             : #include <com/sun/star/beans/XPropertySet.hpp>
      28             : #include <com/sun/star/container/XNameAccess.hpp>
      29             : #include <comphelper/configurationhelper.hxx>
      30             : #include <comphelper/processfactory.hxx>
      31             : 
      32             : #include <svl/smplhint.hxx>
      33             : 
      34             : #include <svtools/colorcfg.hxx>
      35             : 
      36             : #include <vcl/settings.hxx>
      37             : #include <vcl/svapp.hxx>
      38             : #include <rtl/instance.hxx>
      39             : 
      40             : #include "itemholder2.hxx"
      41             : 
      42             : using namespace utl;
      43             : using namespace com::sun::star::uno;
      44             : 
      45             : #define HELP_TIP_TIMEOUT 0xffff     // max. timeout setting to pretend a non-timeout
      46             : 
      47             : namespace
      48             : {
      49             :     const char s_sAccessibility[] = "org.openoffice.Office.Common/Accessibility";
      50             :     const char s_sAutoDetectSystemHC[] = "AutoDetectSystemHC";
      51             :     const char s_sIsForPagePreviews[] = "IsForPagePreviews";
      52             :     const char s_sIsHelpTipsDisappear[] = "IsHelpTipsDisappear";
      53             :     const char s_sHelpTipSeconds[] = "HelpTipSeconds";
      54             :     const char s_sIsAllowAnimatedGraphics[] = "IsAllowAnimatedGraphics";
      55             :     const char s_sIsAllowAnimatedText[] = "IsAllowAnimatedText";
      56             :     const char s_sIsAutomaticFontColor[] = "IsAutomaticFontColor";
      57             :     const char s_sIsSelectionInReadonly[] = "IsSelectionInReadonly";
      58             :     const char s_sColorValueSetColumnCount[] = "ColorValueSetColumnCount";
      59             :     const char s_sEdgeBlending[] = "EdgeBlending";
      60             :     const char s_sListBoxMaximumLineCount[] = "ListBoxMaximumLineCount";
      61             :     const char s_sPreviewUsesCheckeredBackground[]  = "PreviewUsesCheckeredBackground";
      62             : }
      63             : 
      64             : // class SvtAccessibilityOptions_Impl ---------------------------------------------
      65             : 
      66             : class SvtAccessibilityOptions_Impl
      67             : {
      68             : private:
      69             :     css::uno::Reference< css::container::XNameAccess > m_xCfg;
      70             :     bool                                               bIsModified;
      71             : 
      72             : public:
      73             :     SvtAccessibilityOptions_Impl();
      74             :     ~SvtAccessibilityOptions_Impl();
      75             : 
      76             :     void        SetVCLSettings();
      77             :     bool        GetAutoDetectSystemHC();
      78             :     bool        GetIsForPagePreviews() const;
      79             :     bool        GetIsHelpTipsDisappear() const;
      80             :     bool        GetIsAllowAnimatedGraphics() const;
      81             :     bool        GetIsAllowAnimatedText() const;
      82             :     bool        GetIsAutomaticFontColor() const;
      83             :     sal_Int16   GetHelpTipSeconds() const;
      84             :     bool        IsSelectionInReadonly() const;
      85             :     sal_Int16   GetEdgeBlending() const;
      86             :     sal_Int16   GetListBoxMaximumLineCount() const;
      87             :     sal_Int16   GetColorValueSetColumnCount() const;
      88             :     bool        GetPreviewUsesCheckeredBackground() const;
      89             : 
      90             :     void        SetAutoDetectSystemHC(bool bSet);
      91             :     void        SetIsForPagePreviews(bool bSet);
      92             :     void        SetIsHelpTipsDisappear(bool bSet);
      93             :     void        SetIsAllowAnimatedGraphics(bool bSet);
      94             :     void        SetIsAllowAnimatedText(bool bSet);
      95             :     void        SetIsAutomaticFontColor(bool bSet);
      96             :     void        SetHelpTipSeconds(sal_Int16 nSet);
      97             :     void        SetSelectionInReadonly(bool bSet);
      98             : 
      99           0 :     bool        IsModified() const { return bIsModified; };
     100             : };
     101             : 
     102             : // initialization of static members --------------------------------------
     103             : 
     104             : SvtAccessibilityOptions_Impl* SvtAccessibilityOptions::sm_pSingleImplConfig =NULL;
     105             : sal_Int32                     SvtAccessibilityOptions::sm_nAccessibilityRefCount(0);
     106             : 
     107             : namespace
     108             : {
     109             :     struct SingletonMutex
     110             :         : public rtl::Static< ::osl::Mutex, SingletonMutex > {};
     111             : }
     112             : 
     113             : 
     114             : // class SvtAccessibilityOptions_Impl ---------------------------------------------
     115             : 
     116         183 : SvtAccessibilityOptions_Impl::SvtAccessibilityOptions_Impl()
     117             : {
     118             :     try
     119             :     {
     120         366 :         m_xCfg = css::uno::Reference< css::container::XNameAccess >(
     121             :             ::comphelper::ConfigurationHelper::openConfig(
     122             :             comphelper::getProcessComponentContext(),
     123             :             s_sAccessibility,
     124             :             ::comphelper::ConfigurationHelper::E_STANDARD),
     125         183 :             css::uno::UNO_QUERY);
     126             : 
     127         183 :         bIsModified = false;
     128             :     }
     129           0 :     catch(const css::uno::Exception& ex)
     130             :     {
     131           0 :         m_xCfg.clear();
     132             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     133             :     }
     134         183 : }
     135             : 
     136         130 : SvtAccessibilityOptions_Impl::~SvtAccessibilityOptions_Impl()
     137             : {
     138         130 : }
     139             : 
     140             : 
     141           0 : bool SvtAccessibilityOptions_Impl::GetAutoDetectSystemHC()
     142             : {
     143           0 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     144           0 :     bool                                            bRet = true;
     145             : 
     146             :     try
     147             :     {
     148           0 :         if(xNode.is())
     149           0 :             xNode->getPropertyValue(s_sAutoDetectSystemHC) >>= bRet;
     150             :     }
     151           0 :     catch(const css::uno::Exception& ex)
     152             :     {
     153             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     154             :     }
     155             : 
     156           0 :     return bRet;
     157             : }
     158             : 
     159          43 : bool SvtAccessibilityOptions_Impl::GetIsForPagePreviews() const
     160             : {
     161          43 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     162          43 :     bool                                            bRet = true;
     163             : 
     164             :     try
     165             :     {
     166          43 :         if(xNode.is())
     167          43 :             xNode->getPropertyValue(s_sIsForPagePreviews) >>= bRet;
     168             :     }
     169           0 :     catch(const css::uno::Exception& ex)
     170             :     {
     171             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     172             :     }
     173          43 :     return bRet;
     174             : }
     175             : 
     176         116 : bool SvtAccessibilityOptions_Impl::GetIsHelpTipsDisappear() const
     177             : {
     178         116 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     179         116 :     bool                                            bRet = true;
     180             : 
     181             :     try
     182             :     {
     183         116 :         if(xNode.is())
     184         116 :             xNode->getPropertyValue(s_sIsHelpTipsDisappear) >>= bRet;
     185             :     }
     186           0 :     catch(const css::uno::Exception& ex)
     187             :     {
     188             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     189             :     }
     190             : 
     191         116 :     return bRet;
     192             : }
     193             : 
     194       43964 : bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedGraphics() const
     195             : {
     196       43964 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     197       43964 :     bool                                            bRet = true;
     198             : 
     199             :     try
     200             :     {
     201       43964 :         if(xNode.is())
     202       43964 :             xNode->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bRet;
     203             :     }
     204           0 :     catch(const css::uno::Exception& ex)
     205             :     {
     206             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     207             :     }
     208             : 
     209       43964 :     return bRet;
     210             : }
     211             : 
     212       43964 : bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedText() const
     213             : {
     214       43964 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     215       43964 :     bool                                            bRet = true;
     216             : 
     217             :     try
     218             :     {
     219       43964 :         if(xNode.is())
     220       43964 :             xNode->getPropertyValue(s_sIsAllowAnimatedText) >>= bRet;
     221             :     }
     222           0 :     catch(const css::uno::Exception& ex)
     223             :     {
     224             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     225             :     }
     226             : 
     227       43964 :     return bRet;
     228             : }
     229             : 
     230       13253 : bool SvtAccessibilityOptions_Impl::GetIsAutomaticFontColor() const
     231             : {
     232       13253 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     233       13253 :     bool                                            bRet = false;
     234             : 
     235             :     try
     236             :     {
     237       13253 :         if(xNode.is())
     238       13253 :             xNode->getPropertyValue(s_sIsAutomaticFontColor) >>= bRet;
     239             :     }
     240           0 :     catch(const css::uno::Exception& ex)
     241             :     {
     242             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     243             :     }
     244             : 
     245       13253 :     return bRet;
     246             : }
     247             : 
     248         116 : sal_Int16 SvtAccessibilityOptions_Impl::GetHelpTipSeconds() const
     249             : {
     250         116 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     251         116 :     sal_Int16                                       nRet = 4;
     252             : 
     253             :     try
     254             :     {
     255         116 :         if(xNode.is())
     256         116 :             xNode->getPropertyValue(s_sHelpTipSeconds) >>= nRet;
     257             :     }
     258           0 :     catch(const css::uno::Exception& ex)
     259             :     {
     260             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     261             :     }
     262             : 
     263         116 :     return nRet;
     264             : }
     265             : 
     266        5929 : bool SvtAccessibilityOptions_Impl::IsSelectionInReadonly() const
     267             : {
     268        5929 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     269        5929 :     bool                                            bRet = false;
     270             : 
     271             :     try
     272             :     {
     273        5929 :         if(xNode.is())
     274        5929 :             xNode->getPropertyValue(s_sIsSelectionInReadonly) >>= bRet;
     275             :     }
     276           0 :     catch(const css::uno::Exception& ex)
     277             :     {
     278             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     279             :     }
     280             : 
     281        5929 :     return bRet;
     282             : }
     283             : 
     284         116 : sal_Int16 SvtAccessibilityOptions_Impl::GetEdgeBlending() const
     285             : {
     286         116 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     287         116 :     sal_Int16 nRet = 35;
     288             : 
     289             :     try
     290             :     {
     291         116 :         if(xNode.is())
     292         116 :             xNode->getPropertyValue(s_sEdgeBlending) >>= nRet;
     293             :     }
     294           0 :     catch(const css::uno::Exception& ex)
     295             :     {
     296             :         SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
     297             :     }
     298             : 
     299         116 :     return nRet;
     300             : }
     301             : 
     302         116 : sal_Int16 SvtAccessibilityOptions_Impl::GetListBoxMaximumLineCount() const
     303             : {
     304         116 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     305         116 :     sal_Int16 nRet = 25;
     306             : 
     307             :     try
     308             :     {
     309         116 :         if(xNode.is())
     310         116 :             xNode->getPropertyValue(s_sListBoxMaximumLineCount) >>= nRet;
     311             :     }
     312           0 :     catch(const css::uno::Exception& ex)
     313             :     {
     314             :         SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
     315             :     }
     316             : 
     317         116 :     return nRet;
     318             : }
     319             : 
     320         116 : sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const
     321             : {
     322         116 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     323         116 :     sal_Int16 nRet = 12;
     324             : 
     325             :     try
     326             :     {
     327         116 :         if(xNode.is())
     328         116 :             xNode->getPropertyValue(s_sColorValueSetColumnCount) >>= nRet;
     329             :     }
     330           0 :     catch(const css::uno::Exception& ex)
     331             :     {
     332             :         SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
     333             :     }
     334             : 
     335         116 :     return nRet;
     336             : }
     337             : 
     338         116 : bool SvtAccessibilityOptions_Impl::GetPreviewUsesCheckeredBackground() const
     339             : {
     340         116 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     341         116 :     bool bRet = false;
     342             : 
     343             :     try
     344             :     {
     345         116 :         if(xNode.is())
     346         116 :             xNode->getPropertyValue(s_sPreviewUsesCheckeredBackground) >>= bRet;
     347             :     }
     348           0 :     catch(const css::uno::Exception& ex)
     349             :     {
     350             :         SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
     351             :     }
     352             : 
     353         116 :     return bRet;
     354             : }
     355             : 
     356           0 : void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(bool bSet)
     357             : {
     358           0 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     359             : 
     360             :     try
     361             :     {
     362           0 :         if(xNode.is() && xNode->getPropertyValue(s_sAutoDetectSystemHC)!=bSet)
     363             :         {
     364           0 :             xNode->setPropertyValue(s_sAutoDetectSystemHC, css::uno::makeAny(bSet));
     365           0 :             ::comphelper::ConfigurationHelper::flush(m_xCfg);
     366           0 :             svtools::ColorConfig().Reload();
     367           0 :             bIsModified = true;
     368             :         }
     369             :     }
     370           0 :     catch(const css::uno::Exception& ex)
     371             :     {
     372             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     373           0 :     }
     374           0 : }
     375             : 
     376           0 : void SvtAccessibilityOptions_Impl::SetIsForPagePreviews(bool bSet)
     377             : {
     378           0 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     379             : 
     380             :     try
     381             :     {
     382           0 :         if(xNode.is() && xNode->getPropertyValue(s_sIsForPagePreviews)!=bSet)
     383             :         {
     384           0 :             xNode->setPropertyValue(s_sIsForPagePreviews, css::uno::makeAny(bSet));
     385           0 :             ::comphelper::ConfigurationHelper::flush(m_xCfg);
     386             : 
     387           0 :             bIsModified = true;
     388             :         }
     389             :     }
     390           0 :     catch(const css::uno::Exception& ex)
     391             :     {
     392             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     393           0 :     }
     394           0 : }
     395             : 
     396           0 : void SvtAccessibilityOptions_Impl::SetIsHelpTipsDisappear(bool bSet)
     397             : {
     398           0 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     399             : 
     400             :     try
     401             :     {
     402           0 :         if(xNode.is() && xNode->getPropertyValue(s_sIsHelpTipsDisappear)!=bSet)
     403             :         {
     404           0 :             xNode->setPropertyValue(s_sIsHelpTipsDisappear, css::uno::makeAny(bSet));
     405           0 :             ::comphelper::ConfigurationHelper::flush(m_xCfg);
     406             : 
     407           0 :             bIsModified = true;
     408             :         }
     409             :     }
     410           0 :     catch(const css::uno::Exception& ex)
     411             :     {
     412             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     413           0 :     }
     414           0 : }
     415             : 
     416           0 : void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedGraphics(bool bSet)
     417             : {
     418           0 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     419             : 
     420             :     try
     421             :     {
     422           0 :         if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedGraphics)!=bSet)
     423             :         {
     424           0 :             xNode->setPropertyValue(s_sIsAllowAnimatedGraphics, css::uno::makeAny(bSet));
     425           0 :             ::comphelper::ConfigurationHelper::flush(m_xCfg);
     426             : 
     427           0 :             bIsModified = true;
     428             :         }
     429             :     }
     430           0 :     catch(const css::uno::Exception& ex)
     431             :     {
     432             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     433           0 :     }
     434           0 : }
     435             : 
     436           0 : void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedText(bool bSet)
     437             : {
     438           0 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     439             : 
     440             :     try
     441             :     {
     442           0 :         if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedText)!=bSet)
     443             :         {
     444           0 :             xNode->setPropertyValue(s_sIsAllowAnimatedText, css::uno::makeAny(bSet));
     445           0 :             ::comphelper::ConfigurationHelper::flush(m_xCfg);
     446             : 
     447           0 :             bIsModified = true;
     448             :         }
     449             :     }
     450           0 :     catch(const css::uno::Exception& ex)
     451             :     {
     452             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     453           0 :     }
     454           0 : }
     455             : 
     456           0 : void SvtAccessibilityOptions_Impl::SetIsAutomaticFontColor(bool bSet)
     457             : {
     458           0 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     459             : 
     460             :     try
     461             :     {
     462           0 :         if(xNode.is() && xNode->getPropertyValue(s_sIsAutomaticFontColor)!=bSet)
     463             :         {
     464           0 :             xNode->setPropertyValue(s_sIsAutomaticFontColor, css::uno::makeAny(bSet));
     465           0 :             ::comphelper::ConfigurationHelper::flush(m_xCfg);
     466             : 
     467           0 :             bIsModified = true;
     468             :         }
     469             :     }
     470           0 :     catch(const css::uno::Exception& ex)
     471             :     {
     472             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     473           0 :     }
     474           0 : }
     475             : 
     476           0 : void SvtAccessibilityOptions_Impl::SetHelpTipSeconds(sal_Int16 nSet)
     477             : {
     478           0 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     479             : 
     480             :     try
     481             :     {
     482           0 :         if(xNode.is() && xNode->getPropertyValue(s_sHelpTipSeconds)!=nSet)
     483             :         {
     484           0 :             xNode->setPropertyValue(s_sHelpTipSeconds, css::uno::makeAny(nSet));
     485           0 :             ::comphelper::ConfigurationHelper::flush(m_xCfg);
     486             : 
     487           0 :             bIsModified = true;
     488             :         }
     489             :     }
     490           0 :     catch(const css::uno::Exception& ex)
     491             :     {
     492             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     493           0 :     }
     494           0 : }
     495             : 
     496           0 : void SvtAccessibilityOptions_Impl::SetSelectionInReadonly(bool bSet)
     497             : {
     498           0 :     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
     499             : 
     500             :     try
     501             :     {
     502           0 :         if(xNode.is() && xNode->getPropertyValue(s_sIsSelectionInReadonly)!=bSet)
     503             :         {
     504           0 :             xNode->setPropertyValue(s_sIsSelectionInReadonly, css::uno::makeAny(bSet));
     505           0 :             ::comphelper::ConfigurationHelper::flush(m_xCfg);
     506             : 
     507           0 :             bIsModified = true;
     508             :         }
     509             :     }
     510           0 :     catch(const css::uno::Exception& ex)
     511             :     {
     512             :         SAL_WARN("svtools.config", "Caught unexpected: " << ex.Message);
     513           0 :     }
     514           0 : }
     515             : 
     516         116 : void SvtAccessibilityOptions_Impl::SetVCLSettings()
     517             : {
     518         116 :     AllSettings aAllSettings(Application::GetSettings());
     519         232 :     StyleSettings aStyleSettings(aAllSettings.GetStyleSettings());
     520         232 :     HelpSettings aHelpSettings(aAllSettings.GetHelpSettings());
     521         116 :     bool StyleSettingsChanged(false);
     522             : 
     523         116 :     aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT);
     524         116 :     aAllSettings.SetHelpSettings(aHelpSettings);
     525             : 
     526         116 :     const sal_Int16 nEdgeBlendingCountA(GetEdgeBlending());
     527             :     OSL_ENSURE(nEdgeBlendingCountA >= 0, "OOps, negative values for EdgeBlending are not allowed (!)");
     528         116 :     const sal_uInt16 nEdgeBlendingCountB(static_cast< sal_uInt16 >(nEdgeBlendingCountA >= 0 ? nEdgeBlendingCountA : 0));
     529             : 
     530         116 :     if(aStyleSettings.GetEdgeBlending() != nEdgeBlendingCountB)
     531             :     {
     532           0 :         aStyleSettings.SetEdgeBlending(nEdgeBlendingCountB);
     533           0 :         StyleSettingsChanged = true;
     534             :     }
     535             : 
     536         116 :     const sal_Int16 nMaxLineCountA(GetListBoxMaximumLineCount());
     537             :     OSL_ENSURE(nMaxLineCountA >= 0, "OOps, negative values for ListBoxMaximumLineCount are not allowed (!)");
     538         116 :     const sal_uInt16 nMaxLineCountB(static_cast< sal_uInt16 >(nMaxLineCountA >= 0 ? nMaxLineCountA : 0));
     539             : 
     540         116 :     if(aStyleSettings.GetListBoxMaximumLineCount() != nMaxLineCountB)
     541             :     {
     542           0 :         aStyleSettings.SetListBoxMaximumLineCount(nMaxLineCountB);
     543           0 :         StyleSettingsChanged = true;
     544             :     }
     545             : 
     546         116 :     const sal_Int16 nMaxColumnCountA(GetColorValueSetColumnCount());
     547             :     OSL_ENSURE(nMaxColumnCountA >= 0, "OOps, negative values for ColorValueSetColumnCount are not allowed (!)");
     548         116 :     const sal_uInt16 nMaxColumnCountB(static_cast< sal_uInt16 >(nMaxColumnCountA >= 0 ? nMaxColumnCountA : 0));
     549             : 
     550         116 :     if(aStyleSettings.GetColorValueSetColumnCount() != nMaxColumnCountB)
     551             :     {
     552           0 :         aStyleSettings.SetColorValueSetColumnCount(nMaxColumnCountB);
     553           0 :         StyleSettingsChanged = true;
     554             :     }
     555             : 
     556         116 :     const bool bPreviewUsesCheckeredBackground(GetPreviewUsesCheckeredBackground());
     557             : 
     558         116 :     if(aStyleSettings.GetPreviewUsesCheckeredBackground() != bPreviewUsesCheckeredBackground)
     559             :     {
     560           0 :         aStyleSettings.SetPreviewUsesCheckeredBackground(bPreviewUsesCheckeredBackground);
     561           0 :         StyleSettingsChanged = true;
     562             :     }
     563             : 
     564         116 :     if(StyleSettingsChanged)
     565             :     {
     566           0 :         aAllSettings.SetStyleSettings(aStyleSettings);
     567           0 :         Application::MergeSystemSettings(aAllSettings);
     568             :     }
     569             : 
     570         232 :     Application::SetSettings(aAllSettings);
     571         116 : }
     572             : 
     573             : // class SvtAccessibilityOptions --------------------------------------------------
     574             : 
     575        9908 : SvtAccessibilityOptions::SvtAccessibilityOptions()
     576             : {
     577             :     {
     578        9908 :         ::osl::MutexGuard aGuard( SingletonMutex::get() );
     579        9908 :         if(!sm_pSingleImplConfig)
     580             :         {
     581         183 :             sm_pSingleImplConfig = new SvtAccessibilityOptions_Impl;
     582         183 :             svtools::ItemHolder2::holdConfigItem(E_ACCESSIBILITYOPTIONS);
     583             :         }
     584        9908 :         ++sm_nAccessibilityRefCount;
     585             :     }
     586             :     //StartListening( *sm_pSingleImplConfig, sal_True );
     587        9908 : }
     588             : 
     589             : 
     590             : 
     591       19806 : SvtAccessibilityOptions::~SvtAccessibilityOptions()
     592             : {
     593             :     //EndListening( *sm_pSingleImplConfig, sal_True );
     594        9791 :     ::osl::MutexGuard aGuard( SingletonMutex::get() );
     595        9791 :     if( !--sm_nAccessibilityRefCount )
     596             :     {
     597             :         //if( sm_pSingleImplConfig->IsModified() )
     598             :         //  sm_pSingleImplConfig->Commit();
     599         130 :         DELETEZ( sm_pSingleImplConfig );
     600        9791 :     }
     601       10015 : }
     602             : 
     603             : 
     604             : 
     605           0 : void SvtAccessibilityOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
     606             : {
     607           0 :     NotifyListeners(0);
     608           0 :     const SfxSimpleHint* pSfxSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
     609           0 :     if ( pSfxSimpleHint )
     610             :     {
     611           0 :         if ( pSfxSimpleHint->GetId()  == SFX_HINT_ACCESSIBILITY_CHANGED )
     612           0 :             SetVCLSettings();
     613             :     }
     614           0 : }
     615             : 
     616             : 
     617             : 
     618           0 : bool SvtAccessibilityOptions::IsModified() const
     619             : {
     620           0 :     return sm_pSingleImplConfig->IsModified();
     621             : }
     622             : 
     623           0 : bool SvtAccessibilityOptions::GetAutoDetectSystemHC() const
     624             : {
     625           0 :     return sm_pSingleImplConfig->GetAutoDetectSystemHC();
     626             : }
     627          43 : bool SvtAccessibilityOptions::GetIsForPagePreviews() const
     628             : {
     629          43 :     return sm_pSingleImplConfig->GetIsForPagePreviews();
     630             : }
     631           0 : bool SvtAccessibilityOptions::GetIsHelpTipsDisappear() const
     632             : {
     633           0 :     return sm_pSingleImplConfig->GetIsHelpTipsDisappear();
     634             : }
     635       43964 : bool SvtAccessibilityOptions::GetIsAllowAnimatedGraphics() const
     636             : {
     637       43964 :     return sm_pSingleImplConfig->GetIsAllowAnimatedGraphics();
     638             : }
     639       43964 : bool SvtAccessibilityOptions::GetIsAllowAnimatedText() const
     640             : {
     641       43964 :     return sm_pSingleImplConfig->GetIsAllowAnimatedText();
     642             : }
     643       13253 : bool SvtAccessibilityOptions::GetIsAutomaticFontColor() const
     644             : {
     645       13253 :     return sm_pSingleImplConfig->GetIsAutomaticFontColor();
     646             : }
     647           0 : sal_Int16 SvtAccessibilityOptions::GetHelpTipSeconds() const
     648             : {
     649           0 :     return sm_pSingleImplConfig->GetHelpTipSeconds();
     650             : }
     651        5929 : bool SvtAccessibilityOptions::IsSelectionInReadonly() const
     652             : {
     653        5929 :     return sm_pSingleImplConfig->IsSelectionInReadonly();
     654             : }
     655             : 
     656             : 
     657           0 : void SvtAccessibilityOptions::SetAutoDetectSystemHC(bool bSet)
     658             : {
     659           0 :     sm_pSingleImplConfig->SetAutoDetectSystemHC(bSet);
     660           0 : }
     661           0 : void SvtAccessibilityOptions::SetIsForPagePreviews(bool bSet)
     662             : {
     663           0 :     sm_pSingleImplConfig->SetIsForPagePreviews(bSet);
     664           0 : }
     665           0 : void SvtAccessibilityOptions::SetIsHelpTipsDisappear(bool bSet)
     666             : {
     667           0 :     sm_pSingleImplConfig->SetIsHelpTipsDisappear(bSet);
     668           0 : }
     669           0 : void SvtAccessibilityOptions::SetIsAllowAnimatedGraphics(bool bSet)
     670             : {
     671           0 :     sm_pSingleImplConfig->SetIsAllowAnimatedGraphics(bSet);
     672           0 : }
     673           0 : void SvtAccessibilityOptions::SetIsAllowAnimatedText(bool bSet)
     674             : {
     675           0 :     sm_pSingleImplConfig->SetIsAllowAnimatedText(bSet);
     676           0 : }
     677           0 : void SvtAccessibilityOptions::SetIsAutomaticFontColor(bool bSet)
     678             : {
     679           0 :     sm_pSingleImplConfig->SetIsAutomaticFontColor(bSet);
     680           0 : }
     681           0 : void SvtAccessibilityOptions::SetHelpTipSeconds(sal_Int16 nSet)
     682             : {
     683           0 :     sm_pSingleImplConfig->SetHelpTipSeconds(nSet);
     684           0 : }
     685           0 : void SvtAccessibilityOptions::SetSelectionInReadonly(bool bSet)
     686             : {
     687           0 :     sm_pSingleImplConfig->SetSelectionInReadonly(bSet);
     688           0 : }
     689         116 : void SvtAccessibilityOptions::SetVCLSettings()
     690             : {
     691         116 :     sm_pSingleImplConfig->SetVCLSettings();
     692         116 : }
     693             : 
     694             : 
     695             : 
     696             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11