LCOV - code coverage report
Current view: top level - stoc/source/defaultregistry - defaultregistry.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 217 574 37.8 %
Date: 2012-08-25 Functions: 31 61 50.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 351 1760 19.9 %

           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                 :            : #include <osl/mutex.hxx>
      21                 :            : #include <osl/diagnose.h>
      22                 :            : #include <cppuhelper/queryinterface.hxx>
      23                 :            : #include <cppuhelper/weak.hxx>
      24                 :            : #include <cppuhelper/factory.hxx>
      25                 :            : #include <cppuhelper/implbase1.hxx>
      26                 :            : #include <cppuhelper/implbase4.hxx>
      27                 :            : #include <cppuhelper/implbase3.hxx>
      28                 :            : #include <cppuhelper/implementationentry.hxx>
      29                 :            : #include <registry/registry.hxx>
      30                 :            : 
      31                 :            : #include <com/sun/star/registry/XSimpleRegistry.hpp>
      32                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      33                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      34                 :            : #include <com/sun/star/lang/XTypeProvider.hpp>
      35                 :            : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      36                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      37                 :            : #include <com/sun/star/container/XEnumerationAccess.hpp>
      38                 :            : 
      39                 :            : #include <bootstrapservices.hxx>
      40                 :            : 
      41                 :            : using namespace com::sun::star::uno;
      42                 :            : using namespace com::sun::star::registry;
      43                 :            : using namespace com::sun::star::lang;
      44                 :            : using namespace com::sun::star::container;
      45                 :            : using namespace cppu;
      46                 :            : using namespace osl;
      47                 :            : using ::rtl::OUString;
      48                 :            : 
      49                 :            : #define SERVICENAME "com.sun.star.registry.NestedRegistry"
      50                 :            : #define IMPLNAME       "com.sun.star.comp.stoc.NestedRegistry"
      51                 :            : 
      52                 :            : extern rtl_StandardModuleCount g_moduleCount;
      53                 :            : 
      54                 :            : namespace stoc_bootstrap
      55                 :            : {
      56                 :       1517 : Sequence< OUString > defreg_getSupportedServiceNames()
      57                 :            : {
      58                 :       1517 :     Sequence< OUString > seqNames(1);
      59         [ +  - ]:       1517 :     seqNames.getArray()[0] = OUString(SERVICENAME);
      60                 :       1517 :     return seqNames;
      61                 :            : }
      62                 :            : 
      63                 :      10036 : OUString defreg_getImplementationName()
      64                 :            : {
      65                 :      10036 :     return OUString(IMPLNAME);
      66                 :            : }
      67                 :            : }
      68                 :            : 
      69                 :            : namespace stoc_defreg
      70                 :            : {
      71                 :            : //*************************************************************************
      72                 :            : // NestedRegistryImpl
      73                 :            : //*************************************************************************
      74                 :            : class NestedKeyImpl;
      75                 :            : 
      76                 :            : class NestedRegistryImpl    : public WeakAggImplHelper4 < XSimpleRegistry, XInitialization, XServiceInfo, XEnumerationAccess >
      77                 :            : {
      78                 :            : public:
      79                 :            :     NestedRegistryImpl( );
      80                 :            : 
      81                 :            :     ~NestedRegistryImpl();
      82                 :            : 
      83                 :            :     // XServiceInfo
      84                 :            :     virtual OUString SAL_CALL getImplementationName(  ) throw(RuntimeException);
      85                 :            :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
      86                 :            :     virtual Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw(RuntimeException);
      87                 :            : 
      88                 :            :     // XInitialization
      89                 :            :     virtual void SAL_CALL initialize( const Sequence< Any >& aArguments )
      90                 :            :         throw(Exception, RuntimeException);
      91                 :            : 
      92                 :            :     // XSimpleRegistry
      93                 :            :     virtual OUString SAL_CALL getURL() throw(RuntimeException);
      94                 :            :     virtual void SAL_CALL open( const OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) throw(InvalidRegistryException, RuntimeException);
      95                 :            :     virtual sal_Bool SAL_CALL isValid(  ) throw(RuntimeException);
      96                 :            :     virtual void SAL_CALL close(  ) throw(InvalidRegistryException, RuntimeException);
      97                 :            :     virtual void SAL_CALL destroy(  ) throw(InvalidRegistryException, RuntimeException);
      98                 :            :     virtual Reference< XRegistryKey > SAL_CALL getRootKey(  ) throw(InvalidRegistryException, RuntimeException);
      99                 :            :     virtual sal_Bool SAL_CALL isReadOnly(  ) throw(InvalidRegistryException, RuntimeException);
     100                 :            :     virtual void SAL_CALL mergeKey( const OUString& aKeyName, const OUString& aUrl ) throw(InvalidRegistryException, MergeConflictException, RuntimeException);
     101                 :            : 
     102                 :            :     // XEnumerationAccess
     103                 :            :     virtual Reference< XEnumeration > SAL_CALL createEnumeration(  ) throw (RuntimeException);
     104                 :            :     virtual Type SAL_CALL getElementType(  ) throw (RuntimeException);
     105                 :            :     virtual sal_Bool SAL_CALL hasElements(  ) throw (RuntimeException);
     106                 :            : 
     107                 :            :     friend class NestedKeyImpl;
     108                 :            : protected:
     109                 :            :     Mutex                       m_mutex;
     110                 :            :     sal_uInt32                  m_state;
     111                 :            :     Reference<XSimpleRegistry>  m_localReg;
     112                 :            :     Reference<XSimpleRegistry>  m_defaultReg;
     113                 :            : 
     114                 :            : };
     115                 :            : 
     116                 :            : //*************************************************************************
     117                 :            : // class NestedKeyImpl the implenetation of interface XRegistryKey
     118                 :            : //*************************************************************************
     119                 :            : class NestedKeyImpl : public WeakImplHelper1< XRegistryKey >
     120                 :            : {
     121                 :            : public:
     122                 :            :     NestedKeyImpl( NestedRegistryImpl* pDefaultRegistry,
     123                 :            :                    Reference<XRegistryKey>& localKey,
     124                 :            :                    Reference<XRegistryKey>& defaultKey);
     125                 :            : 
     126                 :            :     NestedKeyImpl( const OUString& aKeyName,
     127                 :            :                     NestedKeyImpl* pKey);
     128                 :            : 
     129                 :            :     ~NestedKeyImpl();
     130                 :            : 
     131                 :            :     // XRegistryKey
     132                 :            :     virtual OUString SAL_CALL getKeyName() throw(RuntimeException);
     133                 :            :     virtual sal_Bool SAL_CALL isReadOnly(  ) throw(InvalidRegistryException, RuntimeException);
     134                 :            :     virtual sal_Bool SAL_CALL isValid(  ) throw(RuntimeException);
     135                 :            :     virtual RegistryKeyType SAL_CALL getKeyType( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException);
     136                 :            :     virtual RegistryValueType SAL_CALL getValueType(  ) throw(InvalidRegistryException, RuntimeException);
     137                 :            :     virtual sal_Int32 SAL_CALL getLongValue(  ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
     138                 :            :     virtual void SAL_CALL setLongValue( sal_Int32 value ) throw(InvalidRegistryException, RuntimeException);
     139                 :            :     virtual Sequence< sal_Int32 > SAL_CALL getLongListValue(  ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
     140                 :            :     virtual void SAL_CALL setLongListValue( const ::com::sun::star::uno::Sequence< sal_Int32 >& seqValue ) throw(InvalidRegistryException, RuntimeException);
     141                 :            :     virtual OUString SAL_CALL getAsciiValue(  ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
     142                 :            :     virtual void SAL_CALL setAsciiValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException);
     143                 :            :     virtual Sequence< OUString > SAL_CALL getAsciiListValue(  ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
     144                 :            :     virtual void SAL_CALL setAsciiListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException);
     145                 :            :     virtual OUString SAL_CALL getStringValue(  ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
     146                 :            :     virtual void SAL_CALL setStringValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException);
     147                 :            :     virtual Sequence< OUString > SAL_CALL getStringListValue(  ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
     148                 :            :     virtual void SAL_CALL setStringListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException);
     149                 :            :     virtual Sequence< sal_Int8 > SAL_CALL getBinaryValue(  ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
     150                 :            :     virtual void SAL_CALL setBinaryValue( const ::com::sun::star::uno::Sequence< sal_Int8 >& value ) throw(InvalidRegistryException, RuntimeException);
     151                 :            :     virtual Reference< XRegistryKey > SAL_CALL openKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
     152                 :            :     virtual Reference< XRegistryKey > SAL_CALL createKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
     153                 :            :     virtual void SAL_CALL closeKey(  ) throw(InvalidRegistryException, RuntimeException);
     154                 :            :     virtual void SAL_CALL deleteKey( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException);
     155                 :            :     virtual Sequence< Reference< XRegistryKey > > SAL_CALL openKeys(  ) throw(InvalidRegistryException, RuntimeException);
     156                 :            :     virtual Sequence< OUString > SAL_CALL getKeyNames(  ) throw(InvalidRegistryException, RuntimeException);
     157                 :            :     virtual sal_Bool SAL_CALL createLink( const OUString& aLinkName, const OUString& aLinkTarget ) throw(InvalidRegistryException, RuntimeException);
     158                 :            :     virtual void SAL_CALL deleteLink( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException);
     159                 :            :     virtual OUString SAL_CALL getLinkTarget( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException);
     160                 :            :     virtual OUString SAL_CALL getResolvedName( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
     161                 :            : 
     162                 :            : protected:
     163                 :            :     void        computeChanges();
     164                 :            :     OUString    computeName(const OUString& name);
     165                 :            : 
     166                 :            :     OUString                    m_name;
     167                 :            :     sal_uInt32                  m_state;
     168                 :            :     NestedRegistryImpl*         m_pRegistry;
     169                 :            :     Reference<XRegistryKey>     m_localKey;
     170                 :            :     Reference<XRegistryKey>     m_defaultKey;
     171                 :            : };
     172                 :            : 
     173                 :            : 
     174                 :            : //*************************************************************************
     175                 :     198174 : NestedKeyImpl::NestedKeyImpl( NestedRegistryImpl* pDefaultRegistry,
     176                 :            :                               Reference<XRegistryKey>& localKey,
     177                 :            :                               Reference<XRegistryKey>& defaultKey )
     178                 :     198174 :     : m_pRegistry(pDefaultRegistry)
     179                 :            : {
     180                 :     198174 :     m_pRegistry->acquire();
     181                 :            : 
     182         [ +  - ]:     198174 :     m_localKey = localKey;
     183         [ +  - ]:     198174 :     m_defaultKey = defaultKey;
     184                 :            : 
     185         [ +  + ]:     198174 :     if (m_localKey.is())
     186                 :            :     {
     187 [ +  - ][ +  - ]:     163021 :         m_name = m_localKey->getKeyName();
     188                 :            :     } else
     189         [ +  - ]:      35153 :     if (m_defaultKey.is())
     190                 :            :     {
     191 [ +  - ][ +  - ]:      35153 :         m_name = m_defaultKey->getKeyName();
     192                 :            :     }
     193                 :            : 
     194                 :     198174 :     m_state = m_pRegistry->m_state;
     195                 :     198174 : }
     196                 :            : 
     197                 :            : //*************************************************************************
     198                 :       2090 : NestedKeyImpl::NestedKeyImpl( const OUString& rKeyName,
     199                 :            :                               NestedKeyImpl* pKey)
     200                 :       2090 :     : m_pRegistry(pKey->m_pRegistry)
     201                 :            : {
     202                 :       2090 :     m_pRegistry->acquire();
     203                 :            : 
     204 [ +  - ][ +  - ]:       2090 :     if (pKey->m_localKey.is() && pKey->m_localKey->isValid())
         [ +  - ][ +  - ]
                 [ +  - ]
     205                 :            :     {
     206 [ +  - ][ +  - ]:       2090 :         m_localKey = pKey->m_localKey->openKey(rKeyName);
                 [ +  - ]
     207                 :            :     }
     208 [ -  + ][ #  # ]:       2090 :     if (pKey->m_defaultKey.is() && pKey->m_defaultKey->isValid())
         [ #  # ][ #  # ]
                 [ -  + ]
     209                 :            :     {
     210 [ #  # ][ #  # ]:          0 :         m_defaultKey = pKey->m_defaultKey->openKey(rKeyName);
                 [ #  # ]
     211                 :            :     }
     212                 :            : 
     213         [ +  - ]:       2090 :     if (m_localKey.is())
     214                 :            :     {
     215 [ +  - ][ +  - ]:       2090 :         m_name = m_localKey->getKeyName();
     216                 :            :     } else
     217         [ #  # ]:          0 :     if (m_defaultKey.is())
     218                 :            :     {
     219 [ #  # ][ #  # ]:          0 :         m_name = m_defaultKey->getKeyName();
     220                 :            :     }
     221                 :            : 
     222                 :       2090 :     m_state = m_pRegistry->m_state;
     223                 :       2090 : }
     224                 :            : 
     225                 :            : //*************************************************************************
     226                 :     198890 : NestedKeyImpl::~NestedKeyImpl()
     227                 :            : {
     228         [ +  - ]:     198890 :     if ( m_pRegistry )
     229                 :     198890 :         m_pRegistry->release();
     230         [ -  + ]:     397780 : }
     231                 :            : 
     232                 :            : //*************************************************************************
     233                 :     229130 : void NestedKeyImpl::computeChanges()
     234                 :            : {
     235         [ +  - ]:     229130 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     236         [ -  + ]:     229130 :     if ( m_state != m_pRegistry->m_state )
     237                 :            :     {
     238 [ #  # ][ #  # ]:          0 :         Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
     239                 :            : 
     240 [ #  # ][ #  # ]:          0 :         Reference<XRegistryKey> tmpKey = rootKey->openKey(m_name);
     241                 :            : 
     242         [ #  # ]:          0 :         if ( tmpKey.is() )
     243                 :            :         {
     244 [ #  # ][ #  # ]:          0 :             m_localKey = rootKey->openKey(m_name);
                 [ #  # ]
     245                 :            :         }
     246                 :            : 
     247                 :          0 :         m_state = m_pRegistry->m_state;
     248         [ +  - ]:     229130 :     }
     249                 :     229130 : }
     250                 :            : 
     251                 :            : //*************************************************************************
     252                 :            : // NestedKey_Impl::computeName()
     253                 :            : //
     254                 :     158046 : OUString NestedKeyImpl::computeName(const OUString& name)
     255                 :            : {
     256                 :     158046 :     OUString resLocalName, resDefaultName;
     257                 :            : 
     258         [ +  - ]:     158046 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     259                 :            :     try
     260                 :            :     {
     261 [ +  + ][ +  - ]:     158046 :         if ( m_localKey.is() && m_localKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     262                 :            :         {
     263 [ +  - ][ +  - ]:     155756 :             resLocalName = m_localKey->getResolvedName(name);
     264                 :            :         } else
     265                 :            :         {
     266 [ +  - ][ +  - ]:       2290 :             if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  - ]
     267 [ +  - ][ +  - ]:       2290 :                 return m_defaultKey->getResolvedName(name);
     268                 :            :         }
     269                 :            : 
     270 [ +  - ][ +  - ]:     155756 :         if ( !resLocalName.isEmpty() && m_pRegistry->m_defaultReg->isValid() )
         [ +  - ][ +  - ]
                 [ +  - ]
     271                 :            :         {
     272 [ +  - ][ +  - ]:     155756 :             Reference<XRegistryKey> localRoot(m_pRegistry->m_localReg->getRootKey());
     273 [ +  - ][ +  - ]:     155756 :             Reference<XRegistryKey> defaultRoot(m_pRegistry->m_defaultReg->getRootKey());
     274                 :            : 
     275 [ +  - ][ +  - ]:     155756 :             resDefaultName = defaultRoot->getResolvedName(resLocalName);
     276                 :            : 
     277                 :     155756 :             sal_uInt32 count = 100;
     278                 :            : 
     279 [ -  + ][ #  # ]:     155756 :             while (resLocalName != resDefaultName && count > 0)
                 [ -  + ]
     280                 :            :             {
     281                 :          0 :                 count--;
     282                 :            : 
     283 [ #  # ][ #  # ]:          0 :                 if (resLocalName.isEmpty() || resDefaultName.isEmpty())
                 [ #  # ]
     284         [ #  # ]:          0 :                     throw InvalidRegistryException();
     285                 :            : 
     286 [ #  # ][ #  # ]:          0 :                 resLocalName = localRoot->getResolvedName(resDefaultName);
     287 [ #  # ][ #  # ]:          0 :                 resDefaultName = defaultRoot->getResolvedName(resLocalName);
     288         [ #  # ]:     155756 :             }
     289                 :            :         }
     290                 :            :     }
     291         [ #  # ]:          0 :     catch(InvalidRegistryException& )
     292                 :            :     {
     293                 :            :     }
     294                 :            : 
     295         [ +  - ]:     158046 :     return resLocalName;
     296                 :            : }
     297                 :            : 
     298                 :            : //*************************************************************************
     299                 :      42826 : OUString SAL_CALL NestedKeyImpl::getKeyName() throw(RuntimeException)
     300                 :            : {
     301         [ +  - ]:      42826 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     302         [ +  - ]:      42826 :     return m_name;
     303                 :            : }
     304                 :            : 
     305                 :            : //*************************************************************************
     306                 :          0 : sal_Bool SAL_CALL NestedKeyImpl::isReadOnly(  )
     307                 :            :     throw(InvalidRegistryException, RuntimeException)
     308                 :            : {
     309         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     310         [ #  # ]:          0 :     computeChanges();
     311                 :            : 
     312 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     313 [ #  # ][ #  # ]:          0 :            return m_localKey->isReadOnly();
     314                 :            :     else
     315 [ #  # ][ #  # ]:          0 :         throw InvalidRegistryException();
     316                 :            : }
     317                 :            : 
     318                 :            : //*************************************************************************
     319                 :     434976 : sal_Bool SAL_CALL NestedKeyImpl::isValid(  ) throw(RuntimeException)
     320                 :            : {
     321         [ +  - ]:     434976 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     322 [ +  - ][ +  - ]:     708205 :     return ((m_localKey.is() && m_localKey->isValid()) ||
     323 [ -  + ][ +  - ]:     708205 :             (m_defaultKey.is() && m_defaultKey->isValid()) );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  + ]
     324                 :            : }
     325                 :            : 
     326                 :            : //*************************************************************************
     327                 :          0 : RegistryKeyType SAL_CALL NestedKeyImpl::getKeyType( const OUString& rKeyName )
     328                 :            :     throw(InvalidRegistryException, RuntimeException)
     329                 :            : {
     330         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     331         [ #  # ]:          0 :     computeChanges();
     332                 :            : 
     333 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     334                 :            :     {
     335 [ #  # ][ #  # ]:          0 :         return m_localKey->getKeyType(rKeyName);
     336                 :            :     } else
     337 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     338                 :            :     {
     339 [ #  # ][ #  # ]:          0 :         return m_defaultKey->getKeyType(rKeyName);
     340                 :            :     }
     341                 :            : 
     342         [ #  # ]:          0 :     return RegistryKeyType_KEY;
     343                 :            : }
     344                 :            : 
     345                 :            : //*************************************************************************
     346                 :     114782 : RegistryValueType SAL_CALL NestedKeyImpl::getValueType(  )
     347                 :            :     throw(InvalidRegistryException, RuntimeException)
     348                 :            : {
     349         [ +  - ]:     114782 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     350         [ +  - ]:     114782 :     computeChanges();
     351                 :            : 
     352 [ +  + ][ +  - ]:     114782 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     353                 :            :     {
     354 [ +  - ][ +  - ]:      78461 :         return m_localKey->getValueType();
     355                 :            :     } else
     356 [ +  - ][ +  - ]:      36321 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  - ]
     357                 :            :     {
     358 [ +  - ][ +  - ]:      36321 :         return m_defaultKey->getValueType();
     359                 :            :     }
     360                 :            : 
     361         [ +  - ]:     114782 :     return RegistryValueType_NOT_DEFINED;
     362                 :            : }
     363                 :            : 
     364                 :            : //*************************************************************************
     365                 :          0 : sal_Int32 SAL_CALL NestedKeyImpl::getLongValue(  )
     366                 :            :     throw(InvalidRegistryException, InvalidValueException, RuntimeException)
     367                 :            : {
     368         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     369         [ #  # ]:          0 :     computeChanges();
     370                 :            : 
     371 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     372                 :            :     {
     373 [ #  # ][ #  # ]:          0 :         return m_localKey->getLongValue();
     374                 :            :     } else
     375 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     376                 :            :     {
     377 [ #  # ][ #  # ]:          0 :         return m_defaultKey->getLongValue();
     378                 :            :     } else
     379                 :            :     {
     380         [ #  # ]:          0 :         throw InvalidRegistryException();
     381         [ #  # ]:          0 :     }
     382                 :            : }
     383                 :            : 
     384                 :            : //*************************************************************************
     385                 :          0 : void SAL_CALL NestedKeyImpl::setLongValue( sal_Int32 value )
     386                 :            :     throw(InvalidRegistryException, RuntimeException)
     387                 :            : {
     388         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     389         [ #  # ]:          0 :     computeChanges();
     390                 :            : 
     391 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     392                 :            :     {
     393 [ #  # ][ #  # ]:          0 :         m_localKey->setLongValue(value);
     394                 :            :     } else
     395 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     396                 :            :     {
     397 [ #  # ][ #  # ]:          0 :         Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
     398 [ #  # ][ #  # ]:          0 :         m_localKey = rootKey->createKey(m_name);
                 [ #  # ]
     399 [ #  # ][ #  # ]:          0 :         m_localKey->setLongValue(value);
     400                 :          0 :         m_state = m_pRegistry->m_state++;
     401                 :            :     } else
     402                 :            :     {
     403         [ #  # ]:          0 :         throw InvalidRegistryException();
     404         [ #  # ]:          0 :     }
     405                 :          0 : }
     406                 :            : 
     407                 :            : //*************************************************************************
     408                 :          0 : Sequence< sal_Int32 > SAL_CALL NestedKeyImpl::getLongListValue(  )
     409                 :            :     throw(InvalidRegistryException, InvalidValueException, RuntimeException)
     410                 :            : {
     411         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     412         [ #  # ]:          0 :     computeChanges();
     413                 :            : 
     414 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     415                 :            :     {
     416 [ #  # ][ #  # ]:          0 :         return m_localKey->getLongListValue();
     417                 :            :     } else
     418 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     419                 :            :     {
     420 [ #  # ][ #  # ]:          0 :         return m_defaultKey->getLongListValue();
     421                 :            :     } else
     422                 :            :     {
     423         [ #  # ]:          0 :         throw InvalidRegistryException();
     424         [ #  # ]:          0 :     }
     425                 :            : }
     426                 :            : 
     427                 :            : //*************************************************************************
     428                 :          0 : void SAL_CALL NestedKeyImpl::setLongListValue( const Sequence< sal_Int32 >& seqValue )
     429                 :            :     throw(InvalidRegistryException, RuntimeException)
     430                 :            : {
     431         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     432         [ #  # ]:          0 :     computeChanges();
     433                 :            : 
     434 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     435                 :            :     {
     436 [ #  # ][ #  # ]:          0 :         m_localKey->setLongListValue(seqValue);
     437                 :            :     } else
     438 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     439                 :            :     {
     440 [ #  # ][ #  # ]:          0 :         Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
     441 [ #  # ][ #  # ]:          0 :         m_localKey = rootKey->createKey(m_name);
                 [ #  # ]
     442 [ #  # ][ #  # ]:          0 :         m_localKey->setLongListValue(seqValue);
     443                 :          0 :         m_state = m_pRegistry->m_state++;
     444                 :            :     } else
     445                 :            :     {
     446         [ #  # ]:          0 :         throw InvalidRegistryException();
     447         [ #  # ]:          0 :     }
     448                 :          0 : }
     449                 :            : 
     450                 :            : //*************************************************************************
     451                 :       1302 : OUString SAL_CALL NestedKeyImpl::getAsciiValue(  )
     452                 :            :     throw(InvalidRegistryException, InvalidValueException, RuntimeException)
     453                 :            : {
     454         [ +  - ]:       1302 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     455         [ +  - ]:       1302 :     computeChanges();
     456                 :            : 
     457 [ +  + ][ +  - ]:       1302 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     458                 :            :     {
     459 [ +  - ][ +  - ]:       1182 :         return m_localKey->getAsciiValue();
     460                 :            :     } else
     461 [ +  - ][ +  - ]:        120 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  - ]
     462                 :            :     {
     463 [ +  - ][ +  - ]:        120 :         return m_defaultKey->getAsciiValue();
     464                 :            :     } else
     465                 :            :     {
     466         [ #  # ]:          0 :         throw InvalidRegistryException();
     467         [ +  - ]:       1302 :     }
     468                 :            : }
     469                 :            : 
     470                 :            : //*************************************************************************
     471                 :          0 : void SAL_CALL NestedKeyImpl::setAsciiValue( const OUString& value )
     472                 :            :     throw(InvalidRegistryException, RuntimeException)
     473                 :            : {
     474         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     475         [ #  # ]:          0 :     computeChanges();
     476                 :            : 
     477 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     478                 :            :     {
     479 [ #  # ][ #  # ]:          0 :         m_localKey->setAsciiValue(value);
     480                 :            :     } else
     481 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     482                 :            :     {
     483 [ #  # ][ #  # ]:          0 :         Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
     484 [ #  # ][ #  # ]:          0 :         m_localKey = rootKey->createKey(m_name);
                 [ #  # ]
     485 [ #  # ][ #  # ]:          0 :         m_localKey->setAsciiValue(value);
     486                 :          0 :         m_state = m_pRegistry->m_state++;
     487                 :            :     } else
     488                 :            :     {
     489         [ #  # ]:          0 :         throw InvalidRegistryException();
     490         [ #  # ]:          0 :     }
     491                 :          0 : }
     492                 :            : 
     493                 :            : //*************************************************************************
     494                 :          0 : Sequence< OUString > SAL_CALL NestedKeyImpl::getAsciiListValue(  )
     495                 :            :     throw(InvalidRegistryException, InvalidValueException, RuntimeException)
     496                 :            : {
     497         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     498         [ #  # ]:          0 :     computeChanges();
     499                 :            : 
     500 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     501                 :            :     {
     502 [ #  # ][ #  # ]:          0 :         return m_localKey->getAsciiListValue();
     503                 :            :     } else
     504 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     505                 :            :     {
     506 [ #  # ][ #  # ]:          0 :         return m_defaultKey->getAsciiListValue();
     507                 :            :     } else
     508                 :            :     {
     509         [ #  # ]:          0 :         throw InvalidRegistryException();
     510         [ #  # ]:          0 :     }
     511                 :            : }
     512                 :            : 
     513                 :            : //*************************************************************************
     514                 :          0 : void SAL_CALL NestedKeyImpl::setAsciiListValue( const Sequence< OUString >& seqValue )
     515                 :            :     throw(InvalidRegistryException, RuntimeException)
     516                 :            : {
     517         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     518         [ #  # ]:          0 :     computeChanges();
     519                 :            : 
     520 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     521                 :            :     {
     522 [ #  # ][ #  # ]:          0 :         m_localKey->setAsciiListValue(seqValue);
     523                 :            :     } else
     524 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     525                 :            :     {
     526 [ #  # ][ #  # ]:          0 :         Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
     527 [ #  # ][ #  # ]:          0 :         m_localKey = rootKey->createKey(m_name);
                 [ #  # ]
     528 [ #  # ][ #  # ]:          0 :         m_localKey->setAsciiListValue(seqValue);
     529                 :          0 :         m_state = m_pRegistry->m_state++;
     530                 :            :     } else
     531                 :            :     {
     532         [ #  # ]:          0 :         throw InvalidRegistryException();
     533         [ #  # ]:          0 :     }
     534                 :          0 : }
     535                 :            : 
     536                 :            : //*************************************************************************
     537                 :          0 : OUString SAL_CALL NestedKeyImpl::getStringValue(  )
     538                 :            :     throw(InvalidRegistryException, InvalidValueException, RuntimeException)
     539                 :            : {
     540         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     541         [ #  # ]:          0 :     computeChanges();
     542                 :            : 
     543 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     544                 :            :     {
     545 [ #  # ][ #  # ]:          0 :         return m_localKey->getStringValue();
     546                 :            :     } else
     547 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     548                 :            :     {
     549 [ #  # ][ #  # ]:          0 :         return m_defaultKey->getStringValue();
     550                 :            :     } else
     551                 :            :     {
     552         [ #  # ]:          0 :         throw InvalidRegistryException();
     553         [ #  # ]:          0 :     }
     554                 :            : }
     555                 :            : 
     556                 :            : //*************************************************************************
     557                 :          0 : void SAL_CALL NestedKeyImpl::setStringValue( const OUString& value )
     558                 :            :     throw(InvalidRegistryException, RuntimeException)
     559                 :            : {
     560         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     561         [ #  # ]:          0 :     computeChanges();
     562                 :            : 
     563 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     564                 :            :     {
     565 [ #  # ][ #  # ]:          0 :         m_localKey->setStringValue(value);
     566                 :            :     } else
     567 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     568                 :            :     {
     569 [ #  # ][ #  # ]:          0 :         Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
     570 [ #  # ][ #  # ]:          0 :         m_localKey = rootKey->createKey(m_name);
                 [ #  # ]
     571 [ #  # ][ #  # ]:          0 :         m_localKey->setStringValue(value);
     572                 :          0 :         m_state = m_pRegistry->m_state++;
     573                 :            :     } else
     574                 :            :     {
     575         [ #  # ]:          0 :         throw InvalidRegistryException();
     576         [ #  # ]:          0 :     }
     577                 :          0 : }
     578                 :            : 
     579                 :            : //*************************************************************************
     580                 :          0 : Sequence< OUString > SAL_CALL NestedKeyImpl::getStringListValue(  )
     581                 :            :     throw(InvalidRegistryException, InvalidValueException, RuntimeException)
     582                 :            : {
     583         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     584         [ #  # ]:          0 :     computeChanges();
     585                 :            : 
     586 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     587                 :            :     {
     588 [ #  # ][ #  # ]:          0 :         return m_localKey->getStringListValue();
     589                 :            :     } else
     590 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     591                 :            :     {
     592 [ #  # ][ #  # ]:          0 :         return m_defaultKey->getStringListValue();
     593                 :            :     } else
     594                 :            :     {
     595         [ #  # ]:          0 :         throw InvalidRegistryException();
     596         [ #  # ]:          0 :     }
     597                 :            : }
     598                 :            : 
     599                 :            : //*************************************************************************
     600                 :          0 : void SAL_CALL NestedKeyImpl::setStringListValue( const Sequence< OUString >& seqValue )
     601                 :            :     throw(InvalidRegistryException, RuntimeException)
     602                 :            : {
     603         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     604         [ #  # ]:          0 :     computeChanges();
     605                 :            : 
     606 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     607                 :            :     {
     608 [ #  # ][ #  # ]:          0 :         m_localKey->setStringListValue(seqValue);
     609                 :            :     } else
     610 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     611                 :            :     {
     612 [ #  # ][ #  # ]:          0 :         Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
     613 [ #  # ][ #  # ]:          0 :         m_localKey = rootKey->createKey(m_name);
                 [ #  # ]
     614 [ #  # ][ #  # ]:          0 :         m_localKey->setStringListValue(seqValue);
     615                 :          0 :         m_state = m_pRegistry->m_state++;
     616                 :            :     } else
     617                 :            :     {
     618         [ #  # ]:          0 :         throw InvalidRegistryException();
     619         [ #  # ]:          0 :     }
     620                 :          0 : }
     621                 :            : 
     622                 :            : //*************************************************************************
     623                 :     113046 : Sequence< sal_Int8 > SAL_CALL NestedKeyImpl::getBinaryValue(  )
     624                 :            :     throw(InvalidRegistryException, InvalidValueException, RuntimeException)
     625                 :            : {
     626         [ +  - ]:     113046 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     627         [ +  - ]:     113046 :     computeChanges();
     628                 :            : 
     629 [ +  + ][ +  - ]:     113046 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     630                 :            :     {
     631 [ +  - ][ +  - ]:      76885 :         return m_localKey->getBinaryValue();
     632                 :            :     } else
     633 [ +  - ][ +  - ]:      36161 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  - ]
     634                 :            :     {
     635 [ +  - ][ +  - ]:      36161 :         return m_defaultKey->getBinaryValue();
     636                 :            :     } else
     637                 :            :     {
     638         [ #  # ]:          0 :         throw InvalidRegistryException();
     639         [ +  - ]:     113046 :     }
     640                 :            : }
     641                 :            : 
     642                 :            : //*************************************************************************
     643                 :          0 : void SAL_CALL NestedKeyImpl::setBinaryValue( const Sequence< sal_Int8 >& value )
     644                 :            :     throw(InvalidRegistryException, RuntimeException)
     645                 :            : {
     646         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     647         [ #  # ]:          0 :     computeChanges();
     648                 :            : 
     649 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     650                 :            :     {
     651 [ #  # ][ #  # ]:          0 :         m_localKey->setBinaryValue(value);
     652                 :            :     } else
     653 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     654                 :            :     {
     655 [ #  # ][ #  # ]:          0 :         Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
     656 [ #  # ][ #  # ]:          0 :         m_localKey = rootKey->createKey(m_name);
                 [ #  # ]
     657 [ #  # ][ #  # ]:          0 :         m_localKey->setBinaryValue(value);
     658                 :          0 :         m_state = m_pRegistry->m_state++;
     659                 :            :     } else
     660                 :            :     {
     661         [ #  # ]:          0 :         throw InvalidRegistryException();
     662         [ #  # ]:          0 :     }
     663                 :          0 : }
     664                 :            : 
     665                 :            : //*************************************************************************
     666                 :     115571 : Reference< XRegistryKey > SAL_CALL NestedKeyImpl::openKey( const OUString& aKeyName )
     667                 :            :     throw(InvalidRegistryException, RuntimeException)
     668                 :            : {
     669         [ +  - ]:     115571 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     670 [ +  + ][ -  + ]:     115571 :     if ( !m_localKey.is() && !m_defaultKey.is() )
                 [ -  + ]
     671                 :            :     {
     672         [ #  # ]:          0 :         throw InvalidRegistryException();
     673                 :            :     }
     674                 :            : 
     675         [ +  - ]:     115571 :     OUString resolvedName = computeName(aKeyName);
     676                 :            : 
     677         [ -  + ]:     115571 :     if ( resolvedName.isEmpty() )
     678         [ #  # ]:          0 :         throw InvalidRegistryException();
     679                 :            : 
     680                 :     115571 :     Reference<XRegistryKey> localKey, defaultKey;
     681                 :            : 
     682 [ +  - ][ +  - ]:     115571 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ +  - ][ +  + ]
                 [ +  + ]
     683                 :            :     {
     684 [ +  - ][ +  - ]:     113381 :         localKey = m_pRegistry->m_localReg->getRootKey()->openKey(resolvedName);
         [ +  - ][ +  - ]
                 [ +  - ]
     685                 :            :     }
     686 [ +  + ][ +  - ]:     115571 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     687                 :            :     {
     688 [ +  - ][ +  - ]:     113601 :         defaultKey = m_pRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
         [ +  - ][ +  - ]
                 [ +  - ]
     689                 :            :     }
     690                 :            : 
     691 [ +  + ][ +  + ]:     115571 :     if ( localKey.is() || defaultKey.is() )
                 [ +  + ]
     692                 :            :     {
     693 [ +  - ][ +  - ]:     111588 :         return ((XRegistryKey*)new NestedKeyImpl(m_pRegistry, localKey, defaultKey));
                 [ +  - ]
     694                 :            :     } else
     695                 :            :     {
     696                 :       3983 :         return Reference<XRegistryKey>();
     697         [ +  - ]:     115571 :     }
     698                 :            : }
     699                 :            : 
     700                 :            : //*************************************************************************
     701                 :          0 : Reference< XRegistryKey > SAL_CALL NestedKeyImpl::createKey( const OUString& aKeyName )
     702                 :            :     throw(InvalidRegistryException, RuntimeException)
     703                 :            : {
     704         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     705         [ #  # ]:          0 :     if ( (!m_localKey.is() && !m_defaultKey.is()) ||
           [ #  #  #  # ]
         [ #  # ][ #  # ]
     706 [ #  # ][ #  # ]:          0 :          (m_localKey.is() && m_localKey->isReadOnly()) )
     707                 :            :     {
     708         [ #  # ]:          0 :         throw InvalidRegistryException();
     709                 :            :     }
     710                 :            : 
     711         [ #  # ]:          0 :     OUString resolvedName = computeName(aKeyName);
     712                 :            : 
     713         [ #  # ]:          0 :     if ( resolvedName.isEmpty() )
     714         [ #  # ]:          0 :         throw InvalidRegistryException();
     715                 :            : 
     716 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     717                 :            :     {
     718                 :          0 :         Reference<XRegistryKey> localKey, defaultKey;
     719                 :            : 
     720 [ #  # ][ #  # ]:          0 :         localKey = m_pRegistry->m_localReg->getRootKey()->createKey(resolvedName);
         [ #  # ][ #  # ]
                 [ #  # ]
     721         [ #  # ]:          0 :         if ( localKey.is() )
     722                 :            :         {
     723 [ #  # ][ #  # ]:          0 :             if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     724                 :            :             {
     725 [ #  # ][ #  # ]:          0 :                 defaultKey = m_pRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
         [ #  # ][ #  # ]
                 [ #  # ]
     726                 :            :             }
     727                 :            : 
     728                 :          0 :             m_state = m_pRegistry->m_state++;
     729                 :            : 
     730 [ #  # ][ #  # ]:          0 :             return ((XRegistryKey*)new NestedKeyImpl(m_pRegistry, localKey, defaultKey));
                 [ #  # ]
     731 [ #  # ][ #  # ]:          0 :         }
     732                 :            :     } else
     733                 :            :     {
     734                 :          0 :         Reference<XRegistryKey> localKey, defaultKey;
     735                 :            : 
     736 [ #  # ][ #  # ]:          0 :         if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     737                 :            :         {
     738 [ #  # ][ #  # ]:          0 :             Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
     739 [ #  # ][ #  # ]:          0 :             m_localKey = rootKey->createKey(m_name);
                 [ #  # ]
     740                 :            : 
     741 [ #  # ][ #  # ]:          0 :             localKey = m_pRegistry->m_localReg->getRootKey()->createKey(resolvedName);
         [ #  # ][ #  # ]
                 [ #  # ]
     742                 :            : 
     743         [ #  # ]:          0 :             if ( localKey.is() )
     744                 :            :             {
     745 [ #  # ][ #  # ]:          0 :                 defaultKey = m_pRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
         [ #  # ][ #  # ]
                 [ #  # ]
     746                 :            : 
     747                 :          0 :                 m_state = m_pRegistry->m_state++;
     748                 :            : 
     749 [ #  # ][ #  # ]:          0 :                 return ((XRegistryKey*)new NestedKeyImpl(m_pRegistry, localKey, defaultKey));
                 [ #  # ]
     750         [ #  # ]:          0 :             }
     751 [ #  # ][ #  # ]:          0 :         }
     752                 :            :     }
     753                 :            : 
     754         [ #  # ]:          0 :     return Reference<XRegistryKey>();
     755                 :            : }
     756                 :            : 
     757                 :            : //*************************************************************************
     758                 :     106740 : void SAL_CALL NestedKeyImpl::closeKey(  )
     759                 :            :     throw(InvalidRegistryException, RuntimeException)
     760                 :            : {
     761         [ +  - ]:     106740 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     762 [ +  + ][ +  - ]:     106740 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     763                 :            :     {
     764 [ +  - ][ +  - ]:      73903 :         m_localKey->closeKey();
     765                 :            :     }
     766 [ +  + ][ +  - ]:     106740 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     767                 :            :     {
     768 [ +  - ][ +  - ]:      33185 :         m_defaultKey->closeKey();
     769         [ +  - ]:     106740 :     }
     770                 :     106740 : }
     771                 :            : 
     772                 :            : //*************************************************************************
     773                 :          0 : void SAL_CALL NestedKeyImpl::deleteKey( const OUString& rKeyName )
     774                 :            :     throw(InvalidRegistryException, RuntimeException)
     775                 :            : {
     776         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     777 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     778 [ #  # ][ #  # ]:          0 :          !m_localKey->isReadOnly() )
     779                 :            :     {
     780         [ #  # ]:          0 :         OUString resolvedName = computeName(rKeyName);
     781                 :            : 
     782         [ #  # ]:          0 :         if ( resolvedName.isEmpty() )
     783                 :            :         {
     784         [ #  # ]:          0 :             throw InvalidRegistryException();
     785                 :            :         }
     786                 :            : 
     787 [ #  # ][ #  # ]:          0 :         m_pRegistry->m_localReg->getRootKey()->deleteKey(resolvedName);
         [ #  # ][ #  # ]
     788                 :            :     } else
     789                 :            :     {
     790         [ #  # ]:          0 :         throw InvalidRegistryException();
     791         [ #  # ]:          0 :     }
     792                 :          0 : }
     793                 :            : 
     794                 :            : //*************************************************************************
     795                 :        419 : Sequence< Reference< XRegistryKey > > SAL_CALL NestedKeyImpl::openKeys(  )
     796                 :            :     throw(InvalidRegistryException, RuntimeException)
     797                 :            : {
     798         [ +  - ]:        419 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     799 [ +  + ][ -  + ]:        419 :     if ( !m_localKey.is() && !m_defaultKey.is() )
                 [ -  + ]
     800                 :            :     {
     801         [ #  # ]:          0 :         throw InvalidRegistryException();
     802                 :            :     }
     803                 :            : 
     804 [ +  - ][ +  - ]:        419 :     Sequence<OUString> localSeq, defaultSeq;
     805                 :            : 
     806 [ +  + ][ +  - ]:        419 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     807                 :            :     {
     808 [ +  - ][ +  - ]:        414 :         localSeq = m_localKey->getKeyNames();
         [ +  - ][ +  - ]
     809                 :            :     }
     810 [ +  + ][ +  - ]:        419 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     811                 :            :     {
     812 [ +  - ][ +  - ]:          5 :         defaultSeq = m_defaultKey->getKeyNames();
         [ +  - ][ +  - ]
     813                 :            :     }
     814                 :            : 
     815                 :        419 :     sal_uInt32 local = localSeq.getLength();
     816                 :        419 :     sal_uInt32 def = defaultSeq.getLength();
     817                 :        419 :     sal_uInt32 len = 0;
     818                 :            : 
     819                 :            :     sal_uInt32 i, j;
     820         [ +  + ]:       2509 :     for (i=0; i < local; i++)
     821                 :            :     {
     822         [ -  + ]:       2090 :         for (j=0 ; j < def; j++)
     823                 :            :         {
     824         [ #  # ]:          0 :             if ( localSeq.getConstArray()[i] == defaultSeq.getConstArray()[j] )
     825                 :            :             {
     826                 :          0 :                 len++;
     827                 :          0 :                 break;
     828                 :            :             }
     829                 :            :         }
     830                 :            :     }
     831                 :            : 
     832         [ +  - ]:        419 :     Sequence< Reference<XRegistryKey> > retSeq(local + def - len);
     833                 :        419 :     sal_Bool                            insert = sal_True;
     834                 :        419 :     OUString                            name;
     835                 :            :     sal_Int32                           lastIndex;
     836                 :            : 
     837         [ +  + ]:       2509 :     for (i=0; i < local; i++)
     838                 :            :     {
     839                 :       2090 :         name = localSeq.getConstArray()[i];
     840                 :       2090 :         lastIndex = name.lastIndexOf('/');
     841                 :       2090 :         name = name.copy(lastIndex);
     842         [ +  - ]:       2090 :         retSeq.getArray()[i] =
     843 [ +  - ][ +  - ]:       4180 :             (XRegistryKey*)new NestedKeyImpl(name, this);
                 [ +  - ]
     844                 :            :     }
     845                 :            : 
     846                 :        419 :     sal_uInt32 k = local;
     847         [ -  + ]:        419 :     for (i=0; i < def; i++)
     848                 :            :     {
     849                 :          0 :         insert = sal_True;
     850                 :            : 
     851         [ #  # ]:          0 :         for (j=0 ; j < local; j++)
     852                 :            :         {
     853   [ #  #  #  # ]:          0 :             if ( retSeq.getConstArray()[j]->getKeyName()
     854         [ #  # ]:          0 :                     == defaultSeq.getConstArray()[i] )
     855                 :            :             {
     856                 :          0 :                 insert = sal_False;
     857                 :          0 :                 break;
     858                 :            :             }
     859                 :            :         }
     860                 :            : 
     861         [ #  # ]:          0 :         if ( insert )
     862                 :            :         {
     863                 :          0 :             name = defaultSeq.getConstArray()[i];
     864                 :          0 :             lastIndex = name.lastIndexOf('/');
     865                 :          0 :             name = name.copy(lastIndex);
     866         [ #  # ]:          0 :             retSeq.getArray()[k++] =
     867 [ #  # ][ #  # ]:          0 :                 (XRegistryKey*)new NestedKeyImpl(name, this);
                 [ #  # ]
     868                 :            :         }
     869                 :            :     }
     870                 :            : 
     871 [ +  - ][ +  - ]:        419 :     return retSeq;
                 [ +  - ]
     872                 :            : }
     873                 :            : 
     874                 :            : //*************************************************************************
     875                 :        459 : Sequence< OUString > SAL_CALL NestedKeyImpl::getKeyNames(  )
     876                 :            :     throw(InvalidRegistryException, RuntimeException)
     877                 :            : {
     878         [ +  - ]:        459 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     879 [ +  + ][ -  + ]:        459 :     if ( !m_localKey.is() && !m_defaultKey.is() )
                 [ -  + ]
     880                 :            :     {
     881         [ #  # ]:          0 :         throw InvalidRegistryException();
     882                 :            :     }
     883                 :            : 
     884 [ +  - ][ +  - ]:        459 :     Sequence<OUString> localSeq, defaultSeq;
     885                 :            : 
     886 [ +  + ][ +  - ]:        459 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     887                 :            :     {
     888 [ +  - ][ +  - ]:        394 :         localSeq = m_localKey->getKeyNames();
         [ +  - ][ +  - ]
     889                 :            :     }
     890 [ +  + ][ +  - ]:        459 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ +  - ][ +  - ]
                 [ +  + ]
     891                 :            :     {
     892 [ +  - ][ +  - ]:         65 :         defaultSeq = m_defaultKey->getKeyNames();
         [ +  - ][ +  - ]
     893                 :            :     }
     894                 :            : 
     895                 :        459 :     sal_uInt32 local = localSeq.getLength();
     896                 :        459 :     sal_uInt32 def = defaultSeq.getLength();
     897                 :        459 :     sal_uInt32 len = 0;
     898                 :            : 
     899                 :            :     sal_uInt32 i, j;
     900         [ +  + ]:        853 :     for (i=0; i < local; i++)
     901                 :            :     {
     902         [ -  + ]:        394 :         for (j=0 ; j < def; j++)
     903                 :            :         {
     904         [ #  # ]:          0 :             if ( localSeq.getConstArray()[i] == defaultSeq.getConstArray()[j] )
     905                 :            :             {
     906                 :          0 :                 len++;
     907                 :          0 :                 break;
     908                 :            :             }
     909                 :            :         }
     910                 :            :     }
     911                 :            : 
     912         [ +  - ]:        459 :     Sequence<OUString>  retSeq(local + def - len);
     913                 :        459 :     sal_Bool            insert = sal_True;
     914                 :            : 
     915         [ +  + ]:        853 :     for (i=0; i < local; i++)
     916                 :            :     {
     917         [ +  - ]:        394 :         retSeq.getArray()[i] = localSeq.getConstArray()[i];
     918                 :            :     }
     919                 :            : 
     920                 :        459 :     sal_uInt32 k = local;
     921         [ +  + ]:       2589 :     for (i=0; i < def; i++)
     922                 :            :     {
     923                 :       2130 :         insert = sal_True;
     924                 :            : 
     925         [ -  + ]:       2130 :         for (j=0 ; j < local; j++)
     926                 :            :         {
     927         [ #  # ]:          0 :             if ( retSeq.getConstArray()[j] == defaultSeq.getConstArray()[i] )
     928                 :            :             {
     929                 :          0 :                 insert = sal_False;
     930                 :          0 :                 break;
     931                 :            :             }
     932                 :            :         }
     933                 :            : 
     934         [ +  - ]:       2130 :         if ( insert )
     935         [ +  - ]:       2130 :             retSeq.getArray()[k++] = defaultSeq.getConstArray()[i];
     936                 :            :     }
     937                 :            : 
     938 [ +  - ][ +  - ]:        459 :     return retSeq;
                 [ +  - ]
     939                 :            : }
     940                 :            : 
     941                 :            : //*************************************************************************
     942                 :          0 : sal_Bool SAL_CALL NestedKeyImpl::createLink( const OUString& aLinkName, const OUString& aLinkTarget )
     943                 :            :     throw(InvalidRegistryException, RuntimeException)
     944                 :            : {
     945         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
     946                 :            : 
     947                 :          0 :     sal_Bool isCreated = sal_False;
     948 [ #  # ][ #  # ]:          0 :     if ( !m_localKey.is() && !m_defaultKey.is() )
                 [ #  # ]
     949                 :            :     {
     950         [ #  # ]:          0 :         throw InvalidRegistryException();
     951                 :            :     }
     952                 :            : 
     953                 :          0 :     OUString    linkName;
     954                 :          0 :     OUString    resolvedName;
     955                 :          0 :     sal_Int32   lastIndex = aLinkName.lastIndexOf('/');
     956                 :            : 
     957         [ #  # ]:          0 :     if ( lastIndex > 0 )
     958                 :            :     {
     959                 :          0 :         linkName = aLinkName.copy(0, lastIndex);
     960                 :            : 
     961         [ #  # ]:          0 :         resolvedName = computeName(linkName);
     962                 :            : 
     963         [ #  # ]:          0 :         if ( resolvedName.isEmpty() )
     964                 :            :         {
     965         [ #  # ]:          0 :             throw InvalidRegistryException();
     966                 :            :         }
     967                 :            : 
     968                 :          0 :         resolvedName = resolvedName + aLinkName.copy(lastIndex);
     969                 :            :     } else
     970                 :            :     {
     971         [ #  # ]:          0 :         if ( lastIndex == 0 )
     972                 :          0 :             resolvedName = m_name + aLinkName;
     973                 :            :         else
     974                 :          0 :             resolvedName = m_name + OUString( "/" ) + aLinkName;
     975                 :            :     }
     976                 :            : 
     977 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     978                 :            :     {
     979 [ #  # ][ #  # ]:          0 :         isCreated = m_pRegistry->m_localReg->getRootKey()->createLink(resolvedName, aLinkTarget);
         [ #  # ][ #  # ]
     980                 :            :     } else
     981                 :            :     {
     982 [ #  # ][ #  # ]:          0 :         if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
     983                 :            :         {
     984 [ #  # ][ #  # ]:          0 :             Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
     985 [ #  # ][ #  # ]:          0 :             m_localKey = rootKey->createKey(m_name);
                 [ #  # ]
     986                 :            : 
     987 [ #  # ][ #  # ]:          0 :             isCreated = m_pRegistry->m_localReg->getRootKey()->createLink(resolvedName, aLinkTarget);
         [ #  # ][ #  # ]
     988                 :            :         }
     989                 :            :     }
     990                 :            : 
     991         [ #  # ]:          0 :     if ( isCreated )
     992                 :          0 :         m_state = m_pRegistry->m_state++;
     993                 :            : 
     994         [ #  # ]:          0 :     return isCreated;
     995                 :            : }
     996                 :            : 
     997                 :            : //*************************************************************************
     998                 :          0 : void SAL_CALL NestedKeyImpl::deleteLink( const OUString& rLinkName )
     999                 :            :     throw(InvalidRegistryException, RuntimeException)
    1000                 :            : {
    1001         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
    1002 [ #  # ][ #  # ]:          0 :     if ( !m_localKey.is() && !m_defaultKey.is() )
                 [ #  # ]
    1003                 :            :     {
    1004         [ #  # ]:          0 :         throw InvalidRegistryException();
    1005                 :            :     }
    1006                 :            : 
    1007                 :          0 :     OUString    linkName;
    1008                 :          0 :     OUString    resolvedName;
    1009                 :          0 :     sal_Int32   lastIndex = rLinkName.lastIndexOf('/');
    1010                 :            : 
    1011         [ #  # ]:          0 :     if ( lastIndex > 0 )
    1012                 :            :     {
    1013                 :          0 :         linkName = rLinkName.copy(0, lastIndex);
    1014                 :            : 
    1015         [ #  # ]:          0 :         resolvedName = computeName(linkName);
    1016                 :            : 
    1017         [ #  # ]:          0 :         if ( resolvedName.isEmpty() )
    1018                 :            :         {
    1019         [ #  # ]:          0 :             throw InvalidRegistryException();
    1020                 :            :         }
    1021                 :            : 
    1022                 :          0 :         resolvedName = resolvedName + rLinkName.copy(lastIndex);
    1023                 :            :     } else
    1024                 :            :     {
    1025         [ #  # ]:          0 :         if ( lastIndex == 0 )
    1026                 :          0 :             resolvedName = m_name + rLinkName;
    1027                 :            :         else
    1028                 :          0 :             resolvedName = m_name + OUString( "/" ) + rLinkName;
    1029                 :            :     }
    1030                 :            : 
    1031 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1032 [ #  # ][ #  # ]:          0 :          !m_localKey->isReadOnly() )
    1033                 :            :     {
    1034 [ #  # ][ #  # ]:          0 :         m_pRegistry->m_localReg->getRootKey()->deleteLink(resolvedName);
         [ #  # ][ #  # ]
    1035                 :            :     } else
    1036                 :            :     {
    1037         [ #  # ]:          0 :         throw InvalidRegistryException();
    1038         [ #  # ]:          0 :     }
    1039                 :          0 : }
    1040                 :            : 
    1041                 :            : //*************************************************************************
    1042                 :          0 : OUString SAL_CALL NestedKeyImpl::getLinkTarget( const OUString& rLinkName )
    1043                 :            :     throw(InvalidRegistryException, RuntimeException)
    1044                 :            : {
    1045         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
    1046 [ #  # ][ #  # ]:          0 :     if ( !m_localKey.is() && !m_defaultKey.is() )
                 [ #  # ]
    1047                 :            :     {
    1048         [ #  # ]:          0 :         throw InvalidRegistryException();
    1049                 :            :     }
    1050                 :            : 
    1051                 :          0 :     OUString    linkName;
    1052                 :          0 :     OUString    resolvedName;
    1053                 :          0 :     sal_Int32   lastIndex = rLinkName.lastIndexOf('/');
    1054                 :            : 
    1055         [ #  # ]:          0 :     if ( lastIndex > 0 )
    1056                 :            :     {
    1057                 :          0 :         linkName = rLinkName.copy(0, lastIndex);
    1058                 :            : 
    1059         [ #  # ]:          0 :         resolvedName = computeName(linkName);
    1060                 :            : 
    1061         [ #  # ]:          0 :         if ( resolvedName.isEmpty() )
    1062                 :            :         {
    1063         [ #  # ]:          0 :             throw InvalidRegistryException();
    1064                 :            :         }
    1065                 :            : 
    1066                 :          0 :         resolvedName = resolvedName + rLinkName.copy(lastIndex);
    1067                 :            :     } else
    1068                 :            :     {
    1069         [ #  # ]:          0 :         if ( lastIndex == 0 )
    1070                 :          0 :             resolvedName = m_name + rLinkName;
    1071                 :            :         else
    1072                 :          0 :             resolvedName = m_name + OUString( "/" ) + rLinkName;
    1073                 :            :     }
    1074                 :            : 
    1075                 :          0 :     OUString linkTarget;
    1076 [ #  # ][ #  # ]:          0 :     if ( m_localKey.is() && m_localKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1077                 :            :     {
    1078                 :            :         try
    1079                 :            :         {
    1080 [ #  # ][ #  # ]:          0 :             linkTarget = m_pRegistry->m_localReg->getRootKey()->getLinkTarget(resolvedName);
         [ #  # ][ #  # ]
                 [ #  # ]
    1081                 :            :             return linkTarget;
    1082                 :            :         }
    1083         [ #  # ]:          0 :         catch(InvalidRegistryException& )
    1084                 :            :         {
    1085                 :            :         }
    1086                 :            :     }
    1087                 :            : 
    1088 [ #  # ][ #  # ]:          0 :     if ( m_defaultKey.is() && m_defaultKey->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1089 [ #  # ][ #  # ]:          0 :         linkTarget = m_pRegistry->m_defaultReg->getRootKey()->getLinkTarget(resolvedName);
         [ #  # ][ #  # ]
    1090                 :            : 
    1091         [ #  # ]:          0 :     return linkTarget;
    1092                 :            : }
    1093                 :            : 
    1094                 :            : //*************************************************************************
    1095                 :      42475 : OUString SAL_CALL NestedKeyImpl::getResolvedName( const OUString& aKeyName )
    1096                 :            :     throw(InvalidRegistryException, RuntimeException)
    1097                 :            : {
    1098         [ +  - ]:      42475 :     Guard< Mutex > aGuard( m_pRegistry->m_mutex );
    1099 [ +  + ][ -  + ]:      42475 :     if ( !m_localKey.is() && !m_defaultKey.is() )
                 [ -  + ]
    1100                 :            :     {
    1101         [ #  # ]:          0 :         throw InvalidRegistryException();
    1102                 :            :     }
    1103                 :            : 
    1104         [ +  - ]:      42475 :     OUString resolvedName = computeName(aKeyName);
    1105                 :            : 
    1106         [ -  + ]:      42475 :     if ( resolvedName.isEmpty() )
    1107                 :            :     {
    1108         [ #  # ]:          0 :         throw InvalidRegistryException();
    1109                 :            :     }
    1110                 :            : 
    1111         [ +  - ]:      42475 :     return resolvedName;
    1112                 :            : }
    1113                 :            : 
    1114                 :            : //*************************************************************************
    1115                 :            : //
    1116                 :            : // DefaultRegistry Implementation
    1117                 :            : //
    1118                 :            : //*************************************************************************
    1119                 :        928 : NestedRegistryImpl::NestedRegistryImpl( )
    1120         [ +  - ]:        928 :     : m_state(0)
    1121                 :            : {
    1122         [ +  - ]:        928 :     g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
    1123                 :        928 : }
    1124                 :            : 
    1125                 :            : //*************************************************************************
    1126         [ +  - ]:        342 : NestedRegistryImpl::~NestedRegistryImpl()
    1127                 :            : {
    1128         [ +  - ]:        342 :     g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
    1129         [ -  + ]:        684 : }
    1130                 :            : 
    1131                 :            : 
    1132         [ -  + ]:        868 : class RegistryEnumueration : public WeakImplHelper1< XEnumeration >
    1133                 :            : {
    1134                 :            : public:
    1135                 :        434 :     RegistryEnumueration(
    1136                 :            :         const Reference< XSimpleRegistry > &r1,
    1137                 :            :         const Reference< XSimpleRegistry > &r2 )
    1138                 :        434 :         : m_xReg1( r1 ) , m_xReg2( r2 )
    1139                 :        434 :         {}
    1140                 :            : public:
    1141                 :            :     virtual sal_Bool SAL_CALL hasMoreElements(  ) throw (RuntimeException);
    1142                 :            :     virtual Any SAL_CALL nextElement(  ) throw (NoSuchElementException, WrappedTargetException, RuntimeException);
    1143                 :            : 
    1144                 :            : private:
    1145                 :            :     Reference< XSimpleRegistry > m_xReg1;
    1146                 :            :     Reference< XSimpleRegistry > m_xReg2;
    1147                 :            : };
    1148                 :            : 
    1149                 :       1302 : sal_Bool RegistryEnumueration::hasMoreElements(  ) throw (RuntimeException)
    1150                 :            : {
    1151 [ +  + ][ +  + ]:       1302 :     return m_xReg1.is() || m_xReg2.is();
    1152                 :            : }
    1153                 :            : 
    1154                 :        868 : Any RegistryEnumueration::nextElement(  )
    1155                 :            :     throw (NoSuchElementException, WrappedTargetException, RuntimeException)
    1156                 :            : {
    1157                 :        868 :     Any a;
    1158         [ +  + ]:        868 :     if( m_xReg1.is() )
    1159                 :            :     {
    1160         [ +  - ]:        434 :         a <<= m_xReg1;
    1161                 :        434 :         m_xReg1.clear();
    1162                 :            :     }
    1163         [ +  - ]:        434 :     else if( m_xReg2.is() )
    1164                 :            :     {
    1165         [ +  - ]:        434 :         a <<= m_xReg2;
    1166                 :        434 :         m_xReg2.clear();
    1167                 :            :     }
    1168                 :            :     else
    1169                 :            :     {
    1170                 :            :         throw NoSuchElementException( OUString(
    1171         [ #  # ]:          0 :             "NestedRegistry: no nextElement() !" ),Reference< XInterface > () );
    1172                 :            :     }
    1173                 :        868 :     return a;
    1174                 :            : }
    1175                 :            : 
    1176                 :            : 
    1177                 :        434 : Reference< XEnumeration > NestedRegistryImpl::createEnumeration(  ) throw (RuntimeException)
    1178                 :            : {
    1179         [ +  - ]:        434 :     MutexGuard guard( m_mutex );
    1180 [ +  - ][ +  - ]:        434 :     return new RegistryEnumueration( m_localReg, m_defaultReg );
         [ +  - ][ +  - ]
    1181                 :            : }
    1182                 :            : 
    1183                 :          0 : Type NestedRegistryImpl::getElementType(  ) throw (RuntimeException)
    1184                 :            : {
    1185                 :          0 :     return getCppuType( &m_localReg );
    1186                 :            : }
    1187                 :            : 
    1188                 :          0 : sal_Bool SAL_CALL NestedRegistryImpl::hasElements(  ) throw (RuntimeException)
    1189                 :            : {
    1190         [ #  # ]:          0 :     MutexGuard guard( m_mutex );
    1191 [ #  # ][ #  # ]:          0 :     return m_localReg.is() || m_defaultReg.is();
                 [ #  # ]
    1192                 :            : }
    1193                 :            : 
    1194                 :            : 
    1195                 :            : 
    1196                 :            : //*************************************************************************
    1197                 :          0 : OUString SAL_CALL NestedRegistryImpl::getImplementationName(  )
    1198                 :            :     throw(RuntimeException)
    1199                 :            : {
    1200                 :          0 :     return stoc_bootstrap::defreg_getImplementationName();
    1201                 :            : }
    1202                 :            : 
    1203                 :            : //*************************************************************************
    1204                 :          0 : sal_Bool SAL_CALL NestedRegistryImpl::supportsService( const OUString& ServiceName )
    1205                 :            :     throw(RuntimeException)
    1206                 :            : {
    1207         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_mutex );
    1208         [ #  # ]:          0 :     Sequence< OUString > aSNL = getSupportedServiceNames();
    1209         [ #  # ]:          0 :     const OUString * pArray = aSNL.getArray();
    1210         [ #  # ]:          0 :     for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
    1211         [ #  # ]:          0 :         if( pArray[i] == ServiceName )
    1212                 :          0 :             return sal_True;
    1213 [ #  # ][ #  # ]:          0 :     return sal_False;
    1214                 :            : }
    1215                 :            : 
    1216                 :            : //*************************************************************************
    1217                 :          0 : Sequence<OUString> SAL_CALL NestedRegistryImpl::getSupportedServiceNames(  )
    1218                 :            :     throw(RuntimeException)
    1219                 :            : {
    1220                 :          0 :     return stoc_bootstrap::defreg_getSupportedServiceNames();
    1221                 :            : }
    1222                 :            : 
    1223                 :            : //*************************************************************************
    1224                 :        928 : void SAL_CALL NestedRegistryImpl::initialize( const Sequence< Any >& aArguments )
    1225                 :            :     throw( Exception, RuntimeException )
    1226                 :            : {
    1227         [ +  - ]:        928 :     Guard< Mutex > aGuard( m_mutex );
    1228   [ +  -  +  -  :       2784 :     if ( (aArguments.getLength() == 2) &&
           +  - ][ +  - ]
    1229                 :        928 :          (aArguments[0].getValueType().getTypeClass() == TypeClass_INTERFACE) &&
    1230                 :        928 :          (aArguments[1].getValueType().getTypeClass() == TypeClass_INTERFACE) )
    1231                 :            :     {
    1232         [ +  - ]:        928 :         aArguments[0] >>= m_localReg;
    1233         [ +  - ]:        928 :         aArguments[1] >>= m_defaultReg;
    1234 [ +  - ][ -  + ]:        928 :         if ( m_localReg == m_defaultReg )
    1235         [ #  # ]:          0 :             m_defaultReg = Reference< XSimpleRegistry >();
    1236         [ +  - ]:        928 :     }
    1237                 :        928 : }
    1238                 :            : 
    1239                 :            : //*************************************************************************
    1240                 :          0 : OUString SAL_CALL NestedRegistryImpl::getURL() throw(RuntimeException)
    1241                 :            : {
    1242         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_mutex );
    1243                 :            :     try
    1244                 :            :     {
    1245 [ #  # ][ #  # ]:          0 :         if ( m_localReg.is() && m_localReg->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1246 [ #  # ][ #  # ]:          0 :             return m_localReg->getURL();
    1247                 :            :     }
    1248         [ #  # ]:          0 :     catch(InvalidRegistryException& )
    1249                 :            :     {
    1250                 :            :     }
    1251                 :            : 
    1252 [ #  # ][ #  # ]:          0 :     return OUString();
    1253                 :            : }
    1254                 :            : 
    1255                 :            : //*************************************************************************
    1256                 :          0 : void SAL_CALL NestedRegistryImpl::open( const OUString&, sal_Bool, sal_Bool )
    1257                 :            :     throw(InvalidRegistryException, RuntimeException)
    1258                 :            : {
    1259                 :            :     throw InvalidRegistryException(
    1260                 :            :             OUString("the 'open' method is not specified for a nested registry"),
    1261         [ #  # ]:          0 :             Reference< XInterface >() );
    1262                 :            : }
    1263                 :            : 
    1264                 :            : //*************************************************************************
    1265                 :       1704 : sal_Bool SAL_CALL NestedRegistryImpl::isValid(  ) throw(RuntimeException)
    1266                 :            : {
    1267         [ +  - ]:       1704 :     Guard< Mutex > aGuard( m_mutex );
    1268                 :            :     try
    1269                 :            :     {
    1270 [ +  - ][ +  - ]:       1704 :         if ( (m_localReg.is() && m_localReg->isValid()) ||
                 [ +  - ]
           [ -  +  #  # ]
         [ #  # ][ +  - ]
    1271 [ #  # ][ #  # ]:          0 :              (m_defaultReg.is() && m_defaultReg->isValid()) )
    1272                 :       1704 :             return sal_True;
    1273                 :            :     }
    1274         [ #  # ]:          0 :     catch(InvalidRegistryException& )
    1275                 :            :     {
    1276                 :            :     }
    1277                 :            : 
    1278 [ +  - ][ #  # ]:       1704 :     return sal_False;
    1279                 :            : }
    1280                 :            : 
    1281                 :            : //*************************************************************************
    1282                 :          0 : void SAL_CALL NestedRegistryImpl::close(  )
    1283                 :            :     throw(InvalidRegistryException, RuntimeException)
    1284                 :            : {
    1285         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_mutex );
    1286 [ #  # ][ #  # ]:          0 :     if ( m_localReg.is() && m_localReg->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1287                 :            :     {
    1288 [ #  # ][ #  # ]:          0 :         m_localReg->close();
    1289                 :            :     }
    1290 [ #  # ][ #  # ]:          0 :     if ( m_defaultReg.is() && m_defaultReg->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1291                 :            :     {
    1292 [ #  # ][ #  # ]:          0 :         m_defaultReg->close();
    1293         [ #  # ]:          0 :     }
    1294                 :          0 : }
    1295                 :            : 
    1296                 :            : //*************************************************************************
    1297                 :          0 : void SAL_CALL NestedRegistryImpl::destroy(  )
    1298                 :            :     throw(InvalidRegistryException, RuntimeException)
    1299                 :            : {
    1300                 :            :     throw InvalidRegistryException(
    1301                 :            :             OUString("the 'destroy' method is not specified for a nested registry"),
    1302         [ #  # ]:          0 :             Reference< XInterface >() );
    1303                 :            : }
    1304                 :            : 
    1305                 :            : //*************************************************************************
    1306                 :      86586 : Reference< XRegistryKey > SAL_CALL NestedRegistryImpl::getRootKey(  )
    1307                 :            :     throw(InvalidRegistryException, RuntimeException)
    1308                 :            : {
    1309                 :      86586 :     Reference<XRegistryKey> tmpKey;
    1310                 :            : 
    1311         [ +  - ]:      86586 :     Guard< Mutex > aGuard( m_mutex );
    1312 [ +  - ][ +  - ]:      86586 :     if ( m_localReg.is() && m_localReg->isValid() )
         [ +  - ][ +  - ]
                 [ +  - ]
    1313                 :            :     {
    1314                 :      86586 :         Reference<XRegistryKey> localKey, defaultKey;
    1315                 :            : 
    1316 [ +  - ][ +  - ]:      86586 :         localKey = m_localReg->getRootKey();
                 [ +  - ]
    1317                 :            : 
    1318         [ +  - ]:      86586 :         if ( localKey.is() )
    1319                 :            :         {
    1320 [ +  - ][ +  - ]:      86586 :             if ( m_defaultReg.is() && m_defaultReg->isValid() )
         [ +  - ][ +  - ]
                 [ +  - ]
    1321                 :            :             {
    1322 [ +  - ][ +  - ]:      86586 :                 defaultKey = m_defaultReg->getRootKey();
                 [ +  - ]
    1323                 :            :             }
    1324                 :            : 
    1325 [ +  - ][ +  - ]:      86586 :             return ((XRegistryKey*)new NestedKeyImpl(this, localKey, defaultKey));
                 [ +  - ]
    1326 [ +  - ][ -  + ]:      86586 :         }
    1327                 :            :     } else
    1328                 :            :     {
    1329         [ #  # ]:          0 :         throw InvalidRegistryException();
    1330                 :            :     }
    1331                 :            : 
    1332         [ +  - ]:      86586 :     return Reference<XRegistryKey>();
    1333                 :            : }
    1334                 :            : 
    1335                 :            : //*************************************************************************
    1336                 :          0 : sal_Bool SAL_CALL NestedRegistryImpl::isReadOnly(  )
    1337                 :            :     throw(InvalidRegistryException, RuntimeException)
    1338                 :            : {
    1339         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_mutex );
    1340                 :            :     try
    1341                 :            :     {
    1342 [ #  # ][ #  # ]:          0 :         if ( m_localReg.is() && m_localReg->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1343 [ #  # ][ #  # ]:          0 :             return m_localReg->isReadOnly();
    1344                 :            :     }
    1345         [ #  # ]:          0 :     catch(InvalidRegistryException& )
    1346                 :            :     {
    1347                 :            :     }
    1348                 :            : 
    1349 [ #  # ][ #  # ]:          0 :     return sal_False;
    1350                 :            : }
    1351                 :            : 
    1352                 :            : //*************************************************************************
    1353                 :          0 : void SAL_CALL NestedRegistryImpl::mergeKey( const OUString& aKeyName, const OUString& aUrl )
    1354                 :            :     throw(InvalidRegistryException, MergeConflictException, RuntimeException)
    1355                 :            : {
    1356         [ #  # ]:          0 :     Guard< Mutex > aGuard( m_mutex );
    1357 [ #  # ][ #  # ]:          0 :     if ( m_localReg.is() && m_localReg->isValid() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1358                 :            :     {
    1359 [ #  # ][ #  # ]:          0 :         m_localReg->mergeKey(aKeyName, aUrl);
    1360                 :            : 
    1361                 :          0 :         m_state++;
    1362         [ #  # ]:          0 :     }
    1363                 :          0 : }
    1364                 :            : } // namespace stco_defreg
    1365                 :            : 
    1366                 :            : namespace stoc_bootstrap
    1367                 :            : {
    1368                 :            : //*************************************************************************
    1369                 :        928 : Reference<XInterface> SAL_CALL NestedRegistry_CreateInstance(
    1370                 :            :     SAL_UNUSED_PARAMETER const Reference<XComponentContext>& )
    1371                 :            :     throw(Exception)
    1372                 :            : {
    1373                 :        928 :     Reference<XInterface>   xRet;
    1374 [ +  - ][ +  - ]:        928 :     XSimpleRegistry *pRegistry = (XSimpleRegistry*) new stoc_defreg::NestedRegistryImpl;
    1375                 :            : 
    1376         [ +  - ]:        928 :     if (pRegistry)
    1377                 :            :     {
    1378 [ +  - ][ +  - ]:        928 :         xRet = Reference<XInterface>::query(pRegistry);
    1379                 :            :     }
    1380                 :            : 
    1381                 :        928 :     return xRet;
    1382                 :            : }
    1383                 :            : 
    1384                 :            : }
    1385                 :            : 
    1386                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10