LCOV - code coverage report
Current view: top level - svtools/source/config - accessibilityoptions.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 88 236 37.3 %
Date: 2012-08-25 Functions: 20 47 42.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 67 520 12.9 %

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

Generated by: LCOV version 1.10