LCOV - code coverage report
Current view: top level - svl/source/config - ctloptions.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 68 203 33.5 %
Date: 2012-08-25 Functions: 12 36 33.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 63 206 30.6 %

           Branch data     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 <svl/ctloptions.hxx>
      22                 :            : 
      23                 :            : #include <svl/languageoptions.hxx>
      24                 :            : #include <i18npool/mslangid.hxx>
      25                 :            : #include <unotools/configitem.hxx>
      26                 :            : #include <tools/debug.hxx>
      27                 :            : #include <com/sun/star/uno/Any.h>
      28                 :            : #include <com/sun/star/uno/Sequence.hxx>
      29                 :            : #include <osl/mutex.hxx>
      30                 :            : #include <svl/smplhint.hxx>
      31                 :            : #include <rtl/instance.hxx>
      32                 :            : #include <unotools/syslocale.hxx>
      33                 :            : #include <itemholder2.hxx>
      34                 :            : 
      35                 :            : using namespace ::com::sun::star;
      36                 :            : using namespace ::com::sun::star::uno;
      37                 :            : 
      38                 :            : #define CFG_READONLY_DEFAULT    sal_False
      39                 :            : 
      40                 :            : // SvtCJKOptions_Impl ----------------------------------------------------------
      41                 :            : 
      42                 :            : class SvtCTLOptions_Impl : public utl::ConfigItem
      43                 :            : {
      44                 :            : private:
      45                 :            :     sal_Bool                        m_bIsLoaded;
      46                 :            :     sal_Bool                        m_bCTLFontEnabled;
      47                 :            :     sal_Bool                        m_bCTLSequenceChecking;
      48                 :            :     sal_Bool                        m_bCTLRestricted;
      49                 :            :     sal_Bool                        m_bCTLTypeAndReplace;
      50                 :            :     SvtCTLOptions::CursorMovement   m_eCTLCursorMovement;
      51                 :            :     SvtCTLOptions::TextNumerals     m_eCTLTextNumerals;
      52                 :            : 
      53                 :            :     sal_Bool                        m_bROCTLFontEnabled;
      54                 :            :     sal_Bool                        m_bROCTLSequenceChecking;
      55                 :            :     sal_Bool                        m_bROCTLRestricted;
      56                 :            :     sal_Bool                        m_bROCTLTypeAndReplace;
      57                 :            :     sal_Bool                        m_bROCTLCursorMovement;
      58                 :            :     sal_Bool                        m_bROCTLTextNumerals;
      59                 :            : 
      60                 :            : public:
      61                 :            :     SvtCTLOptions_Impl();
      62                 :            :     ~SvtCTLOptions_Impl();
      63                 :            : 
      64                 :            :     virtual void    Notify( const Sequence< rtl::OUString >& _aPropertyNames );
      65                 :            :     virtual void    Commit();
      66                 :            :     void            Load();
      67                 :            : 
      68                 :      81493 :     sal_Bool        IsLoaded() { return m_bIsLoaded; }
      69                 :            :     void            SetCTLFontEnabled( sal_Bool _bEnabled );
      70                 :      13424 :     sal_Bool        IsCTLFontEnabled() const { return m_bCTLFontEnabled; }
      71                 :            : 
      72                 :            :     void            SetCTLSequenceChecking( sal_Bool _bEnabled );
      73                 :          0 :     sal_Bool        IsCTLSequenceChecking() const { return m_bCTLSequenceChecking;}
      74                 :            : 
      75                 :            :     void            SetCTLSequenceCheckingRestricted( sal_Bool _bEnable );
      76                 :          0 :     sal_Bool        IsCTLSequenceCheckingRestricted( void ) const   { return m_bCTLRestricted; }
      77                 :            : 
      78                 :            :     void            SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable );
      79                 :          0 :     sal_Bool        IsCTLSequenceCheckingTypeAndReplace() const { return m_bCTLTypeAndReplace; }
      80                 :            : 
      81                 :            :     void            SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement );
      82                 :            :     SvtCTLOptions::CursorMovement
      83                 :          0 :                     GetCTLCursorMovement() const { return m_eCTLCursorMovement; }
      84                 :            : 
      85                 :            :     void            SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals );
      86                 :            :     SvtCTLOptions::TextNumerals
      87                 :    1062290 :                     GetCTLTextNumerals() const { return m_eCTLTextNumerals; }
      88                 :            : 
      89                 :            :     sal_Bool        IsReadOnly(SvtCTLOptions::EOption eOption) const;
      90                 :            : };
      91                 :            : //------------------------------------------------------------------------------
      92                 :            : namespace
      93                 :            : {
      94                 :            :     struct PropertyNames
      95                 :            :         : public rtl::Static< Sequence< rtl::OUString >, PropertyNames > {};
      96                 :            : }
      97                 :            : //------------------------------------------------------------------------------
      98                 :          0 : sal_Bool SvtCTLOptions_Impl::IsReadOnly(SvtCTLOptions::EOption eOption) const
      99                 :            : {
     100                 :          0 :     sal_Bool bReadOnly = CFG_READONLY_DEFAULT;
     101   [ #  #  #  #  :          0 :     switch(eOption)
                #  #  # ]
     102                 :            :     {
     103                 :          0 :         case SvtCTLOptions::E_CTLFONT             : bReadOnly = m_bROCTLFontEnabled       ; break;
     104                 :          0 :         case SvtCTLOptions::E_CTLSEQUENCECHECKING : bReadOnly = m_bROCTLSequenceChecking  ; break;
     105                 :          0 :         case SvtCTLOptions::E_CTLCURSORMOVEMENT   : bReadOnly = m_bROCTLCursorMovement    ; break;
     106                 :          0 :         case SvtCTLOptions::E_CTLTEXTNUMERALS     : bReadOnly = m_bROCTLTextNumerals      ; break;
     107                 :          0 :         case SvtCTLOptions::E_CTLSEQUENCECHECKINGRESTRICTED: bReadOnly = m_bROCTLRestricted  ; break;
     108                 :          0 :         case SvtCTLOptions::E_CTLSEQUENCECHECKINGTYPEANDREPLACE: bReadOnly = m_bROCTLTypeAndReplace; break;
     109                 :            :         default: OSL_FAIL(  "SvtCTLOptions_Impl::IsReadOnly() - invalid option" );
     110                 :            :     }
     111                 :          0 :     return bReadOnly;
     112                 :            : }
     113                 :            : //------------------------------------------------------------------------------
     114                 :        230 : SvtCTLOptions_Impl::SvtCTLOptions_Impl() :
     115                 :            : 
     116                 :            :     utl::ConfigItem("Office.Common/I18N/CTL"),
     117                 :            : 
     118                 :            :     m_bIsLoaded             ( sal_False ),
     119                 :            :     m_bCTLFontEnabled       ( sal_False ),
     120                 :            :     m_bCTLSequenceChecking  ( sal_False ),
     121                 :            :     m_bCTLRestricted        ( sal_False ),
     122                 :            :     m_eCTLCursorMovement    ( SvtCTLOptions::MOVEMENT_LOGICAL ),
     123                 :            :     m_eCTLTextNumerals      ( SvtCTLOptions::NUMERALS_ARABIC ),
     124                 :            : 
     125                 :            :     m_bROCTLFontEnabled     ( CFG_READONLY_DEFAULT ),
     126                 :            :     m_bROCTLSequenceChecking( CFG_READONLY_DEFAULT ),
     127                 :            :     m_bROCTLRestricted      ( CFG_READONLY_DEFAULT ),
     128                 :            :     m_bROCTLCursorMovement  ( CFG_READONLY_DEFAULT ),
     129         [ +  - ]:        230 :     m_bROCTLTextNumerals    ( CFG_READONLY_DEFAULT )
     130                 :            : {
     131                 :        230 : }
     132                 :            : //------------------------------------------------------------------------------
     133                 :        164 : SvtCTLOptions_Impl::~SvtCTLOptions_Impl()
     134                 :            : {
     135 [ +  - ][ -  + ]:        164 :     if ( IsModified() == sal_True )
     136         [ #  # ]:          0 :         Commit();
     137         [ -  + ]:        328 : }
     138                 :            : // -----------------------------------------------------------------------------
     139                 :          0 : void SvtCTLOptions_Impl::Notify( const Sequence< rtl::OUString >& )
     140                 :            : {
     141                 :          0 :     Load();
     142                 :          0 :     NotifyListeners(SFX_HINT_CTL_SETTINGS_CHANGED);
     143                 :          0 : }
     144                 :            : // -----------------------------------------------------------------------------
     145                 :          0 : void SvtCTLOptions_Impl::Commit()
     146                 :            : {
     147         [ #  # ]:          0 :     Sequence< rtl::OUString > &rPropertyNames = PropertyNames::get();
     148         [ #  # ]:          0 :     rtl::OUString* pOrgNames = rPropertyNames.getArray();
     149                 :          0 :     sal_Int32 nOrgCount = rPropertyNames.getLength();
     150                 :            : 
     151         [ #  # ]:          0 :     Sequence< rtl::OUString > aNames( nOrgCount );
     152         [ #  # ]:          0 :     Sequence< Any > aValues( nOrgCount );
     153                 :            : 
     154         [ #  # ]:          0 :     rtl::OUString* pNames = aNames.getArray();
     155         [ #  # ]:          0 :     Any* pValues = aValues.getArray();
     156                 :          0 :     sal_Int32 nRealCount = 0;
     157                 :            : 
     158         [ #  # ]:          0 :     const uno::Type& rType = ::getBooleanCppuType();
     159                 :            : 
     160         [ #  # ]:          0 :     for ( int nProp = 0; nProp < nOrgCount; nProp++ )
     161                 :            :     {
     162   [ #  #  #  #  :          0 :         switch ( nProp )
                #  #  # ]
     163                 :            :         {
     164                 :            :             case  0:
     165                 :            :             {
     166         [ #  # ]:          0 :                 if (!m_bROCTLFontEnabled)
     167                 :            :                 {
     168                 :          0 :                     pNames[nRealCount] = pOrgNames[nProp];
     169                 :          0 :                     pValues[nRealCount].setValue( &m_bCTLFontEnabled, rType );
     170                 :          0 :                     ++nRealCount;
     171                 :            :                 }
     172                 :            :             }
     173                 :          0 :             break;
     174                 :            : 
     175                 :            :             case  1:
     176                 :            :             {
     177         [ #  # ]:          0 :                 if (!m_bROCTLSequenceChecking)
     178                 :            :                 {
     179                 :          0 :                     pNames[nRealCount] = pOrgNames[nProp];
     180                 :          0 :                     pValues[nRealCount].setValue( &m_bCTLSequenceChecking, rType );
     181                 :          0 :                     ++nRealCount;
     182                 :            :                 }
     183                 :            :             }
     184                 :          0 :             break;
     185                 :            : 
     186                 :            :             case  2:
     187                 :            :             {
     188         [ #  # ]:          0 :                 if (!m_bROCTLCursorMovement)
     189                 :            :                 {
     190                 :          0 :                     pNames[nRealCount] = pOrgNames[nProp];
     191         [ #  # ]:          0 :                     pValues[nRealCount] <<= (sal_Int32)m_eCTLCursorMovement;
     192                 :          0 :                     ++nRealCount;
     193                 :            :                 }
     194                 :            :             }
     195                 :          0 :             break;
     196                 :            : 
     197                 :            :             case  3:
     198                 :            :             {
     199         [ #  # ]:          0 :                 if (!m_bROCTLTextNumerals)
     200                 :            :                 {
     201                 :          0 :                     pNames[nRealCount] = pOrgNames[nProp];
     202         [ #  # ]:          0 :                     pValues[nRealCount] <<= (sal_Int32)m_eCTLTextNumerals;
     203                 :          0 :                     ++nRealCount;
     204                 :            :                 }
     205                 :            :             }
     206                 :          0 :             break;
     207                 :            : 
     208                 :            :             case  4:
     209                 :            :             {
     210         [ #  # ]:          0 :                 if (!m_bROCTLRestricted)
     211                 :            :                 {
     212                 :          0 :                     pNames[nRealCount] = pOrgNames[nProp];
     213                 :          0 :                     pValues[nRealCount].setValue( &m_bCTLRestricted, rType );
     214                 :          0 :                     ++nRealCount;
     215                 :            :                 }
     216                 :            :             }
     217                 :          0 :             break;
     218                 :            :             case 5:
     219                 :            :             {
     220         [ #  # ]:          0 :                 if(!m_bROCTLTypeAndReplace)
     221                 :            :                 {
     222                 :          0 :                     pNames[nRealCount] = pOrgNames[nProp];
     223                 :          0 :                     pValues[nRealCount].setValue( &m_bCTLTypeAndReplace, rType );
     224                 :          0 :                     ++nRealCount;
     225                 :            :                 }
     226                 :            :             }
     227                 :          0 :             break;
     228                 :            :         }
     229                 :            :     }
     230         [ #  # ]:          0 :     aNames.realloc(nRealCount);
     231         [ #  # ]:          0 :     aValues.realloc(nRealCount);
     232         [ #  # ]:          0 :     PutProperties( aNames, aValues );
     233                 :            :     //broadcast changes
     234 [ #  # ][ #  # ]:          0 :     NotifyListeners(SFX_HINT_CTL_SETTINGS_CHANGED);
                 [ #  # ]
     235                 :          0 : }
     236                 :            : // -----------------------------------------------------------------------------
     237                 :        230 : void SvtCTLOptions_Impl::Load()
     238                 :            : {
     239         [ +  - ]:        230 :     Sequence< rtl::OUString >& rPropertyNames = PropertyNames::get();
     240         [ +  - ]:        230 :     if ( !rPropertyNames.getLength() )
     241                 :            :     {
     242         [ +  - ]:        230 :         rPropertyNames.realloc(6);
     243         [ +  - ]:        230 :         rtl::OUString* pNames = rPropertyNames.getArray();
     244                 :        230 :         pNames[0] = "CTLFont";
     245                 :        230 :         pNames[1] = "CTLSequenceChecking";
     246                 :        230 :         pNames[2] = "CTLCursorMovement";
     247                 :        230 :         pNames[3] = "CTLTextNumerals";
     248                 :        230 :         pNames[4] = "CTLSequenceCheckingRestricted";
     249                 :        230 :         pNames[5] = "CTLSequenceCheckingTypeAndReplace";
     250         [ +  - ]:        230 :         EnableNotification( rPropertyNames );
     251                 :            :     }
     252         [ +  - ]:        230 :     Sequence< Any > aValues = GetProperties( rPropertyNames );
     253         [ +  - ]:        230 :     Sequence< sal_Bool > aROStates = GetReadOnlyStates( rPropertyNames );
     254                 :        230 :     const Any* pValues = aValues.getConstArray();
     255                 :        230 :     const sal_Bool* pROStates = aROStates.getConstArray();
     256                 :            :     DBG_ASSERT( aValues.getLength() == rPropertyNames.getLength(), "GetProperties failed" );
     257                 :            :     DBG_ASSERT( aROStates.getLength() == rPropertyNames.getLength(), "GetReadOnlyStates failed" );
     258 [ +  - ][ +  - ]:        230 :     if ( aValues.getLength() == rPropertyNames.getLength() && aROStates.getLength() == rPropertyNames.getLength() )
                 [ +  - ]
     259                 :            :     {
     260                 :        230 :         sal_Bool bValue = sal_False;
     261                 :        230 :         sal_Int32 nValue = 0;
     262                 :            : 
     263         [ +  + ]:       1610 :         for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ )
     264                 :            :         {
     265         [ +  - ]:       1380 :             if ( pValues[nProp].hasValue() )
     266                 :            :             {
     267         [ +  + ]:       1380 :                 if ( pValues[nProp] >>= bValue )
     268                 :            :                 {
     269   [ +  +  +  +  :        920 :                     switch ( nProp )
                      - ]
     270                 :            :                     {
     271                 :        230 :                         case 0: { m_bCTLFontEnabled = bValue; m_bROCTLFontEnabled = pROStates[nProp]; } break;
     272                 :        230 :                         case 1: { m_bCTLSequenceChecking = bValue; m_bROCTLSequenceChecking = pROStates[nProp]; } break;
     273                 :        230 :                         case 4: { m_bCTLRestricted = bValue; m_bROCTLRestricted = pROStates[nProp]; } break;
     274                 :        920 :                         case 5: { m_bCTLTypeAndReplace = bValue; m_bROCTLTypeAndReplace = pROStates[nProp]; } break;
     275                 :            :                     }
     276                 :            :                 }
     277         [ +  - ]:        460 :                 else if ( pValues[nProp] >>= nValue )
     278                 :            :                 {
     279      [ +  +  - ]:        460 :                     switch ( nProp )
     280                 :            :                     {
     281                 :        230 :                         case 2: { m_eCTLCursorMovement = (SvtCTLOptions::CursorMovement)nValue; m_bROCTLCursorMovement = pROStates[nProp]; } break;
     282                 :        460 :                         case 3: { m_eCTLTextNumerals = (SvtCTLOptions::TextNumerals)nValue; m_bROCTLTextNumerals = pROStates[nProp]; } break;
     283                 :            :                     }
     284                 :            :                 }
     285                 :            :             }
     286                 :            :         }
     287                 :            :     }
     288         [ +  - ]:        230 :     sal_uInt16 nType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM);
     289         [ +  - ]:        230 :     SvtSystemLanguageOptions aSystemLocaleSettings;
     290         [ +  - ]:        230 :     LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage();
     291         [ +  - ]:        230 :     sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage );
     292 [ +  + ][ +  - ]:        230 :     if( !m_bCTLFontEnabled && (( nType & SCRIPTTYPE_COMPLEX ) ||
         [ +  - ][ -  + ]
     293                 :            :             ((eSystemLanguage != LANGUAGE_SYSTEM)  && ( nWinScript & SCRIPTTYPE_COMPLEX )))  )
     294                 :            :     {
     295                 :          0 :         m_bCTLFontEnabled = sal_True;
     296 [ #  # ][ #  # ]:          0 :         sal_uInt16 nLanguage = SvtSysLocale().GetLanguage();
                 [ #  # ]
     297                 :            :         //enable sequence checking for the appropriate languages
     298                 :            :         m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace =
     299         [ #  # ]:          0 :             (MsLangId::needsSequenceChecking( nLanguage) ||
     300 [ #  # ][ #  # ]:          0 :              MsLangId::needsSequenceChecking( eSystemLanguage));
                 [ #  # ]
     301         [ #  # ]:          0 :         Commit();
     302                 :            :     }
     303 [ +  - ][ +  - ]:        230 :     m_bIsLoaded = sal_True;
                 [ +  - ]
     304                 :        230 : }
     305                 :            : //------------------------------------------------------------------------------
     306                 :          0 : void SvtCTLOptions_Impl::SetCTLFontEnabled( sal_Bool _bEnabled )
     307                 :            : {
     308 [ #  # ][ #  # ]:          0 :     if(!m_bROCTLFontEnabled && m_bCTLFontEnabled != _bEnabled)
     309                 :            :     {
     310                 :          0 :         m_bCTLFontEnabled = _bEnabled;
     311                 :          0 :         SetModified();
     312                 :          0 :         NotifyListeners(0);
     313                 :            :     }
     314                 :          0 : }
     315                 :            : //------------------------------------------------------------------------------
     316                 :          0 : void SvtCTLOptions_Impl::SetCTLSequenceChecking( sal_Bool _bEnabled )
     317                 :            : {
     318 [ #  # ][ #  # ]:          0 :     if(!m_bROCTLSequenceChecking && m_bCTLSequenceChecking != _bEnabled)
     319                 :            :     {
     320                 :          0 :         SetModified();
     321                 :          0 :         m_bCTLSequenceChecking = _bEnabled;
     322                 :          0 :         NotifyListeners(0);
     323                 :            :     }
     324                 :          0 : }
     325                 :            : //------------------------------------------------------------------------------
     326                 :          0 : void SvtCTLOptions_Impl::SetCTLSequenceCheckingRestricted( sal_Bool _bEnabled )
     327                 :            : {
     328 [ #  # ][ #  # ]:          0 :     if(!m_bROCTLRestricted && m_bCTLRestricted != _bEnabled)
     329                 :            :     {
     330                 :          0 :         SetModified();
     331                 :          0 :         m_bCTLRestricted = _bEnabled;
     332                 :          0 :         NotifyListeners(0);
     333                 :            :     }
     334                 :          0 : }
     335                 :            : //------------------------------------------------------------------------------
     336                 :          0 : void  SvtCTLOptions_Impl::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnabled )
     337                 :            : {
     338 [ #  # ][ #  # ]:          0 :     if(!m_bROCTLTypeAndReplace && m_bCTLTypeAndReplace != _bEnabled)
     339                 :            :     {
     340                 :          0 :         SetModified();
     341                 :          0 :         m_bCTLTypeAndReplace = _bEnabled;
     342                 :          0 :         NotifyListeners(0);
     343                 :            :     }
     344                 :          0 : }
     345                 :            : //------------------------------------------------------------------------------
     346                 :          0 : void SvtCTLOptions_Impl::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement )
     347                 :            : {
     348 [ #  # ][ #  # ]:          0 :     if (!m_bROCTLCursorMovement && m_eCTLCursorMovement != _eMovement )
     349                 :            :     {
     350                 :          0 :         SetModified();
     351                 :          0 :         m_eCTLCursorMovement = _eMovement;
     352                 :          0 :         NotifyListeners(0);
     353                 :            :     }
     354                 :          0 : }
     355                 :            : //------------------------------------------------------------------------------
     356                 :          0 : void SvtCTLOptions_Impl::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals )
     357                 :            : {
     358 [ #  # ][ #  # ]:          0 :     if (!m_bROCTLTextNumerals && m_eCTLTextNumerals != _eNumerals )
     359                 :            :     {
     360                 :          0 :         SetModified();
     361                 :          0 :         m_eCTLTextNumerals = _eNumerals;
     362                 :          0 :         NotifyListeners(0);
     363                 :            :     }
     364                 :          0 : }
     365                 :            : // global ----------------------------------------------------------------
     366                 :            : 
     367                 :            : static SvtCTLOptions_Impl*  pCTLOptions = NULL;
     368                 :            : static sal_Int32            nCTLRefCount = 0;
     369                 :            : namespace { struct CTLMutex : public rtl::Static< osl::Mutex, CTLMutex > {}; }
     370                 :            : 
     371                 :            : // class SvtCTLOptions --------------------------------------------------
     372                 :            : 
     373                 :      81651 : SvtCTLOptions::SvtCTLOptions( sal_Bool bDontLoad )
     374                 :            : {
     375                 :            :     // Global access, must be guarded (multithreading)
     376 [ +  - ][ +  - ]:      81651 :     ::osl::MutexGuard aGuard( CTLMutex::get() );
     377         [ +  + ]:      81651 :     if ( !pCTLOptions )
     378                 :            :     {
     379 [ +  - ][ +  - ]:        230 :         pCTLOptions = new SvtCTLOptions_Impl;
     380         [ +  - ]:        230 :         ItemHolder2::holdConfigItem(E_CTLOPTIONS);
     381                 :            :     }
     382 [ +  + ][ +  + ]:      81651 :     if( !bDontLoad && !pCTLOptions->IsLoaded() )
                 [ +  + ]
     383         [ +  - ]:        230 :         pCTLOptions->Load();
     384                 :            : 
     385                 :      81651 :     ++nCTLRefCount;
     386                 :      81651 :     m_pImp = pCTLOptions;
     387 [ +  - ][ +  - ]:      81651 :     m_pImp->AddListener(this);
     388                 :      81651 : }
     389                 :            : 
     390                 :            : // -----------------------------------------------------------------------
     391                 :            : 
     392                 :      81573 : SvtCTLOptions::~SvtCTLOptions()
     393                 :            : {
     394                 :            :     // Global access, must be guarded (multithreading)
     395 [ +  - ][ +  - ]:      81573 :     ::osl::MutexGuard aGuard( CTLMutex::get() );
     396                 :            : 
     397         [ +  - ]:      81573 :     m_pImp->RemoveListener(this);
     398         [ +  + ]:      81573 :     if ( !--nCTLRefCount )
     399 [ +  - ][ +  - ]:      81573 :         DELETEZ( pCTLOptions );
                 [ +  - ]
     400         [ -  + ]:     109349 : }
     401                 :            : // -----------------------------------------------------------------------------
     402                 :          0 : void SvtCTLOptions::SetCTLFontEnabled( sal_Bool _bEnabled )
     403                 :            : {
     404                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     405                 :          0 :     pCTLOptions->SetCTLFontEnabled( _bEnabled );
     406                 :          0 : }
     407                 :            : // -----------------------------------------------------------------------------
     408                 :      13424 : sal_Bool SvtCTLOptions::IsCTLFontEnabled() const
     409                 :            : {
     410                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     411                 :      13424 :     return pCTLOptions->IsCTLFontEnabled();
     412                 :            : }
     413                 :            : // -----------------------------------------------------------------------------
     414                 :          0 : void SvtCTLOptions::SetCTLSequenceChecking( sal_Bool _bEnabled )
     415                 :            : {
     416                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     417                 :          0 :     pCTLOptions->SetCTLSequenceChecking(_bEnabled);
     418                 :          0 : }
     419                 :            : // -----------------------------------------------------------------------------
     420                 :          0 : sal_Bool SvtCTLOptions::IsCTLSequenceChecking() const
     421                 :            : {
     422                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     423                 :          0 :     return pCTLOptions->IsCTLSequenceChecking();
     424                 :            : }
     425                 :            : // -----------------------------------------------------------------------------
     426                 :          0 : void SvtCTLOptions::SetCTLSequenceCheckingRestricted( sal_Bool _bEnable )
     427                 :            : {
     428                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     429                 :          0 :     pCTLOptions->SetCTLSequenceCheckingRestricted(_bEnable);
     430                 :          0 : }
     431                 :            : // -----------------------------------------------------------------------------
     432                 :          0 : sal_Bool SvtCTLOptions::IsCTLSequenceCheckingRestricted( void ) const
     433                 :            : {
     434                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     435                 :          0 :     return pCTLOptions->IsCTLSequenceCheckingRestricted();
     436                 :            : }
     437                 :            : // -----------------------------------------------------------------------------
     438                 :          0 : void SvtCTLOptions::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable )
     439                 :            : {
     440                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     441                 :          0 :     pCTLOptions->SetCTLSequenceCheckingTypeAndReplace(_bEnable);
     442                 :          0 : }
     443                 :            : // -----------------------------------------------------------------------------
     444                 :          0 : sal_Bool SvtCTLOptions::IsCTLSequenceCheckingTypeAndReplace() const
     445                 :            : {
     446                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     447                 :          0 :     return pCTLOptions->IsCTLSequenceCheckingTypeAndReplace();
     448                 :            : }
     449                 :            : // -----------------------------------------------------------------------------
     450                 :          0 : void SvtCTLOptions::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement )
     451                 :            : {
     452                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     453                 :          0 :     pCTLOptions->SetCTLCursorMovement( _eMovement );
     454                 :          0 : }
     455                 :            : // -----------------------------------------------------------------------------
     456                 :          0 : SvtCTLOptions::CursorMovement SvtCTLOptions::GetCTLCursorMovement() const
     457                 :            : {
     458                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     459                 :          0 :     return pCTLOptions->GetCTLCursorMovement();
     460                 :            : }
     461                 :            : // -----------------------------------------------------------------------------
     462                 :          0 : void SvtCTLOptions::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals )
     463                 :            : {
     464                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     465                 :          0 :     pCTLOptions->SetCTLTextNumerals( _eNumerals );
     466                 :          0 : }
     467                 :            : // -----------------------------------------------------------------------------
     468                 :    1062290 : SvtCTLOptions::TextNumerals SvtCTLOptions::GetCTLTextNumerals() const
     469                 :            : {
     470                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     471                 :    1062290 :     return pCTLOptions->GetCTLTextNumerals();
     472                 :            : }
     473                 :            : // -----------------------------------------------------------------------------
     474                 :          0 : sal_Bool SvtCTLOptions::IsReadOnly(EOption eOption) const
     475                 :            : {
     476                 :            :     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
     477                 :          0 :     return pCTLOptions->IsReadOnly(eOption);
     478                 :            : }
     479                 :            : // -----------------------------------------------------------------------------
     480                 :            : 
     481                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10