LCOV - code coverage report
Current view: top level - ucb/source/ucp/hierarchy - hierarchydatasource.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 143 245 58.4 %
Date: 2012-08-25 Functions: 32 57 56.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 183 739 24.8 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : /**************************************************************************
      31                 :            :                                 TODO
      32                 :            :  **************************************************************************
      33                 :            : 
      34                 :            :  Note: Configuration Management classes do not support XAggregation.
      35                 :            :        So I have to wrap the interesting interfaces manually.
      36                 :            : 
      37                 :            :  *************************************************************************/
      38                 :            : #include "hierarchydatasource.hxx"
      39                 :            : #include <osl/diagnose.h>
      40                 :            : 
      41                 :            : #include "osl/doublecheckedlocking.h"
      42                 :            : #include <cppuhelper/interfacecontainer.hxx>
      43                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      44                 :            : #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
      45                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      46                 :            : #include <com/sun/star/util/XChangesBatch.hpp>
      47                 :            : #include <com/sun/star/util/XChangesNotifier.hpp>
      48                 :            : 
      49                 :            : using namespace com::sun::star;
      50                 :            : using namespace hierarchy_ucp;
      51                 :            : 
      52                 :            : //=========================================================================
      53                 :            : 
      54                 :            : // describe path of cfg entry
      55                 :            : #define CFGPROPERTY_NODEPATH    "nodepath"
      56                 :            : // true->async. update; false->sync. update
      57                 :            : #define CFGPROPERTY_LAZYWRITE   "lazywrite"
      58                 :            : 
      59                 :            : #define READ_SERVICE_NAME      "com.sun.star.ucb.HierarchyDataReadAccess"
      60                 :            : #define READWRITE_SERVICE_NAME "com.sun.star.ucb.HierarchyDataReadWriteAccess"
      61                 :            : 
      62                 :            : #define CONFIG_PROVIDER_SERVICE_NAME  \
      63                 :            :                         "com.sun.star.configuration.ConfigurationProvider"
      64                 :            : #define CONFIG_READ_SERVICE_NAME      \
      65                 :            :                         "com.sun.star.configuration.ConfigurationAccess"
      66                 :            : #define CONFIG_READWRITE_SERVICE_NAME \
      67                 :            :                         "com.sun.star.configuration.ConfigurationUpdateAccess"
      68                 :            : #define CONFIG_DATA_ROOT_KEY          \
      69                 :            :                         "/org.openoffice.ucb.Hierarchy/Root"
      70                 :            : 
      71                 :            : //=========================================================================
      72                 :            : 
      73                 :            : namespace hcp_impl
      74                 :            : {
      75                 :            : 
      76                 :            : //=========================================================================
      77                 :            : //
      78                 :            : // HierarchyDataReadAccess Implementation.
      79                 :            : //
      80                 :            : //=========================================================================
      81                 :            : 
      82                 :            : class HierarchyDataAccess : public cppu::OWeakObject,
      83                 :            :                             public lang::XServiceInfo,
      84                 :            :                             public lang::XTypeProvider,
      85                 :            :                             public lang::XComponent,
      86                 :            :                             public lang::XSingleServiceFactory,
      87                 :            :                             public container::XHierarchicalNameAccess,
      88                 :            :                             public container::XNameContainer,
      89                 :            :                             public util::XChangesNotifier,
      90                 :            :                             public util::XChangesBatch
      91                 :            : {
      92                 :            :     osl::Mutex m_aMutex;
      93                 :            :     uno::Reference< uno::XInterface > m_xConfigAccess;
      94                 :            :     uno::Reference< lang::XComponent >                   m_xCfgC;
      95                 :            :     uno::Reference< lang::XSingleServiceFactory >        m_xCfgSSF;
      96                 :            :     uno::Reference< container::XHierarchicalNameAccess > m_xCfgHNA;
      97                 :            :     uno::Reference< container::XNameContainer >          m_xCfgNC;
      98                 :            :     uno::Reference< container::XNameReplace >            m_xCfgNR;
      99                 :            :     uno::Reference< container::XNameAccess >             m_xCfgNA;
     100                 :            :     uno::Reference< container::XElementAccess >          m_xCfgEA;
     101                 :            :     uno::Reference< util::XChangesNotifier >             m_xCfgCN;
     102                 :            :     uno::Reference< util::XChangesBatch >                m_xCfgCB;
     103                 :            :     bool m_bReadOnly;
     104                 :            : 
     105                 :            : public:
     106                 :            :     HierarchyDataAccess( const uno::Reference<
     107                 :            :                                         uno::XInterface > & xConfigAccess,
     108                 :            :                          bool bReadOnly );
     109                 :            :     virtual ~HierarchyDataAccess();
     110                 :            : 
     111                 :            :     // XInterface
     112                 :            :     XINTERFACE_DECL()
     113                 :            : 
     114                 :            :     // XServiceInfo
     115                 :            :     XSERVICEINFO_DECL()
     116                 :            : 
     117                 :            :     // XTypeProvider
     118                 :            :     XTYPEPROVIDER_DECL()
     119                 :            : 
     120                 :            :     // XComponent
     121                 :            :     virtual void SAL_CALL
     122                 :            :     dispose()
     123                 :            :         throw ( uno::RuntimeException );
     124                 :            :     virtual void SAL_CALL
     125                 :            :     addEventListener( const uno::Reference< lang::XEventListener > & xListener )
     126                 :            :         throw ( uno::RuntimeException );
     127                 :            :     virtual void SAL_CALL
     128                 :            :     removeEventListener( const uno::Reference<
     129                 :            :                             lang::XEventListener > & aListener )
     130                 :            :         throw ( uno::RuntimeException );
     131                 :            : 
     132                 :            :     // XSingleServiceFactory
     133                 :            :     virtual uno::Reference< uno::XInterface > SAL_CALL
     134                 :            :     createInstance()
     135                 :            :         throw ( uno::Exception, uno::RuntimeException );
     136                 :            :     virtual uno::Reference< uno::XInterface > SAL_CALL
     137                 :            :     createInstanceWithArguments( const uno::Sequence< uno::Any > & aArguments )
     138                 :            :         throw ( uno::Exception, uno::RuntimeException );
     139                 :            : 
     140                 :            :     // XHierarchicalNameAccess
     141                 :            :     virtual uno::Any SAL_CALL
     142                 :            :     getByHierarchicalName( const rtl::OUString & aName )
     143                 :            :         throw ( container::NoSuchElementException, uno::RuntimeException );
     144                 :            :     virtual sal_Bool SAL_CALL
     145                 :            :     hasByHierarchicalName( const rtl::OUString & aName )
     146                 :            :         throw ( uno::RuntimeException );
     147                 :            : 
     148                 :            :     // XNameContainer
     149                 :            :     virtual void SAL_CALL
     150                 :            :     insertByName( const rtl::OUString & aName, const uno::Any & aElement )
     151                 :            :         throw ( lang::IllegalArgumentException,
     152                 :            :                 container::ElementExistException,
     153                 :            :                 lang::WrappedTargetException,
     154                 :            :                 uno::RuntimeException );
     155                 :            :     virtual void SAL_CALL
     156                 :            :     removeByName( const rtl::OUString & Name )
     157                 :            :         throw ( container::NoSuchElementException,
     158                 :            :                 lang::WrappedTargetException,
     159                 :            :                 uno::RuntimeException );
     160                 :            : 
     161                 :            :     // XNameReplace ( base of XNameContainer )
     162                 :            :     virtual void SAL_CALL
     163                 :            :     replaceByName( const rtl::OUString & aName, const uno::Any & aElement )
     164                 :            :         throw ( lang::IllegalArgumentException,
     165                 :            :                 container::NoSuchElementException,
     166                 :            :                 lang::WrappedTargetException,
     167                 :            :                 uno::RuntimeException );
     168                 :            : 
     169                 :            :     // XNameAccess ( base of XNameReplace )
     170                 :            :     virtual uno::Any SAL_CALL
     171                 :            :     getByName( const rtl::OUString & aName )
     172                 :            :         throw ( container::NoSuchElementException,
     173                 :            :                 lang::WrappedTargetException,
     174                 :            :                 uno::RuntimeException );
     175                 :            :     virtual uno::Sequence< rtl::OUString > SAL_CALL
     176                 :            :     getElementNames()
     177                 :            :         throw ( uno::RuntimeException );
     178                 :            :     virtual sal_Bool SAL_CALL
     179                 :            :     hasByName( const rtl::OUString & aName )
     180                 :            :         throw ( uno::RuntimeException );
     181                 :            : 
     182                 :            :     // XElementAccess ( base of XNameAccess )
     183                 :            :     virtual uno::Type SAL_CALL
     184                 :            :     getElementType()
     185                 :            :         throw ( uno::RuntimeException );
     186                 :            :     virtual sal_Bool SAL_CALL
     187                 :            :     hasElements()
     188                 :            :         throw ( uno::RuntimeException );
     189                 :            : 
     190                 :            :     // XChangesNotifier
     191                 :            :     virtual void SAL_CALL
     192                 :            :     addChangesListener( const uno::Reference<
     193                 :            :                             util::XChangesListener > & aListener )
     194                 :            :         throw ( uno::RuntimeException );
     195                 :            :     virtual void SAL_CALL
     196                 :            :     removeChangesListener( const uno::Reference<
     197                 :            :                             util::XChangesListener > & aListener )
     198                 :            :         throw ( uno::RuntimeException );
     199                 :            : 
     200                 :            :     // XChangesBatch
     201                 :            :     virtual void SAL_CALL
     202                 :            :     commitChanges()
     203                 :            :         throw ( lang::WrappedTargetException, uno::RuntimeException );
     204                 :            :     virtual sal_Bool SAL_CALL
     205                 :            :     hasPendingChanges()
     206                 :            :         throw ( uno::RuntimeException );
     207                 :            :     virtual uno::Sequence< util::ElementChange > SAL_CALL
     208                 :            :     getPendingChanges()
     209                 :            :         throw ( uno::RuntimeException );
     210                 :            : };
     211                 :            : 
     212                 :            : } // namespace hcp_impl
     213                 :            : 
     214                 :            : using namespace hcp_impl;
     215                 :            : 
     216                 :            : //=========================================================================
     217                 :            : //=========================================================================
     218                 :            : //
     219                 :            : // HierarchyDataSource Implementation.
     220                 :            : //
     221                 :            : //=========================================================================
     222                 :            : //=========================================================================
     223                 :            : 
     224                 :          4 : HierarchyDataSource::HierarchyDataSource(
     225                 :            :         const uno::Reference< lang::XMultiServiceFactory > & rxServiceMgr )
     226                 :            : : m_xSMgr( rxServiceMgr ),
     227         [ +  - ]:          4 :   m_pDisposeEventListeners( 0 )
     228                 :            : {
     229                 :          4 : }
     230                 :            : 
     231                 :            : //=========================================================================
     232                 :            : // virtual
     233         [ +  - ]:          4 : HierarchyDataSource::~HierarchyDataSource()
     234                 :            : {
     235 [ +  + ][ +  - ]:          4 :     delete m_pDisposeEventListeners;
     236         [ -  + ]:          8 : }
     237                 :            : 
     238                 :            : //=========================================================================
     239                 :            : //
     240                 :            : // XInterface methods.
     241                 :            : //
     242                 :            : //=========================================================================
     243                 :            : 
     244 [ +  - ][ +  + ]:        712 : XINTERFACE_IMPL_4( HierarchyDataSource,
                 [ +  - ]
     245                 :            :                    lang::XTypeProvider,
     246                 :            :                    lang::XServiceInfo,
     247                 :            :                    lang::XComponent,
     248                 :            :                    lang::XMultiServiceFactory );
     249                 :            : 
     250                 :            : //=========================================================================
     251                 :            : //
     252                 :            : // XTypeProvider methods.
     253                 :            : //
     254                 :            : //=========================================================================
     255                 :            : 
     256 [ #  # ][ #  # ]:          0 : XTYPEPROVIDER_IMPL_4( HierarchyDataSource,
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     257                 :            :                       lang::XTypeProvider,
     258                 :            :                       lang::XServiceInfo,
     259                 :            :                       lang::XComponent,
     260                 :            :                       lang::XMultiServiceFactory );
     261                 :            : 
     262                 :            : //=========================================================================
     263                 :            : //
     264                 :            : // XServiceInfo methods.
     265                 :            : //
     266                 :            : //=========================================================================
     267                 :            : 
     268 [ +  - ][ +  - ]:         12 : XSERVICEINFO_IMPL_0( HierarchyDataSource,
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     269                 :          4 :                      rtl::OUString( "com.sun.star.comp.ucb.HierarchyDataSource" ) )
     270                 :            : {
     271                 :          4 :     uno::Sequence< rtl::OUString > aSNS( 2 );
     272         [ +  - ]:          4 :     aSNS[ 0 ] = rtl::OUString( "com.sun.star.ucb.DefaultHierarchyDataSource" );
     273         [ +  - ]:          4 :     aSNS[ 1 ] = rtl::OUString( "com.sun.star.ucb.HierarchyDataSource" );
     274                 :          4 :     return aSNS;
     275                 :            : }
     276                 :            : 
     277 [ +  - ][ +  - ]:          4 : ONE_INSTANCE_SERVICE_FACTORY_IMPL( HierarchyDataSource );
     278                 :            : 
     279                 :            : //=========================================================================
     280                 :            : //
     281                 :            : // XComponent methods.
     282                 :            : //
     283                 :            : //=========================================================================
     284                 :            : 
     285                 :            : // virtual
     286                 :          6 : void SAL_CALL HierarchyDataSource::dispose()
     287                 :            :     throw( uno::RuntimeException )
     288                 :            : {
     289         [ +  - ]:          6 :     osl::Guard< osl::Mutex > aGuard( m_aMutex );
     290                 :            : 
     291 [ +  + ][ +  - ]:          6 :     if ( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength() )
         [ +  + ][ +  + ]
     292                 :            :     {
     293         [ +  - ]:          2 :         lang::EventObject aEvt;
     294         [ +  - ]:          2 :         aEvt.Source = static_cast< lang::XComponent * >( this );
     295 [ +  - ][ +  - ]:          2 :         m_pDisposeEventListeners->disposeAndClear( aEvt );
     296         [ +  - ]:          6 :     }
     297                 :          6 : }
     298                 :            : 
     299                 :            : //=========================================================================
     300                 :            : // virtual
     301                 :          4 : void SAL_CALL HierarchyDataSource::addEventListener(
     302                 :            :                     const uno::Reference< lang::XEventListener > & Listener )
     303                 :            :     throw( uno::RuntimeException )
     304                 :            : {
     305         [ +  - ]:          4 :     osl::Guard< osl::Mutex > aGuard( m_aMutex );
     306                 :            : 
     307         [ +  + ]:          4 :     if ( !m_pDisposeEventListeners )
     308                 :            :         m_pDisposeEventListeners
     309         [ +  - ]:          2 :             = new cppu::OInterfaceContainerHelper( m_aMutex );
     310                 :            : 
     311 [ +  - ][ +  - ]:          4 :     m_pDisposeEventListeners->addInterface( Listener );
     312                 :          4 : }
     313                 :            : 
     314                 :            : //=========================================================================
     315                 :            : // virtual
     316                 :          2 : void SAL_CALL HierarchyDataSource::removeEventListener(
     317                 :            :                     const uno::Reference< lang::XEventListener > & Listener )
     318                 :            :     throw( uno::RuntimeException )
     319                 :            : {
     320         [ +  - ]:          2 :     osl::Guard< osl::Mutex > aGuard( m_aMutex );
     321                 :            : 
     322         [ +  - ]:          2 :     if ( m_pDisposeEventListeners )
     323 [ +  - ][ +  - ]:          2 :         m_pDisposeEventListeners->removeInterface( Listener );
     324                 :          2 : }
     325                 :            : 
     326                 :            : //=========================================================================
     327                 :            : //
     328                 :            : // XMultiServiceFactory methods.
     329                 :            : //
     330                 :            : //=========================================================================
     331                 :            : 
     332                 :            : // virtual
     333                 :            : uno::Reference< uno::XInterface > SAL_CALL
     334                 :          4 : HierarchyDataSource::createInstance( const rtl::OUString & aServiceSpecifier )
     335                 :            :     throw ( uno::Exception, uno::RuntimeException )
     336                 :            : {
     337                 :            :     // Create view to root node.
     338                 :            : 
     339                 :          4 :     beans::PropertyValue aProp;
     340                 :          4 :     aProp.Name = rtl::OUString( CFGPROPERTY_NODEPATH  );
     341         [ +  - ]:          4 :     aProp.Value <<= rtl::OUString( CONFIG_DATA_ROOT_KEY  );
     342                 :            : 
     343         [ +  - ]:          4 :     uno::Sequence< uno::Any > aArguments( 1 );
     344 [ +  - ][ +  - ]:          4 :     aArguments[ 0 ] <<= aProp;
     345                 :            : 
     346 [ +  - ][ +  - ]:          4 :     return createInstanceWithArguments( aServiceSpecifier, aArguments, false );
     347                 :            : }
     348                 :            : 
     349                 :            : //=========================================================================
     350                 :            : // virtual
     351                 :            : uno::Reference< uno::XInterface > SAL_CALL
     352                 :         38 : HierarchyDataSource::createInstanceWithArguments(
     353                 :            :                                 const rtl::OUString & ServiceSpecifier,
     354                 :            :                                 const uno::Sequence< uno::Any > & Arguments )
     355                 :            :     throw ( uno::Exception, uno::RuntimeException )
     356                 :            : {
     357                 :         38 :     return createInstanceWithArguments( ServiceSpecifier, Arguments, true );
     358                 :            : }
     359                 :            : 
     360                 :            : //=========================================================================
     361                 :            : // virtual
     362                 :            : uno::Sequence< rtl::OUString > SAL_CALL
     363                 :         34 : HierarchyDataSource::getAvailableServiceNames()
     364                 :            :     throw ( uno::RuntimeException )
     365                 :            : {
     366                 :         34 :     uno::Sequence< rtl::OUString > aNames( 2 );
     367         [ +  - ]:         34 :     aNames[ 0 ] = rtl::OUString( READ_SERVICE_NAME  );
     368         [ +  - ]:         34 :     aNames[ 1 ] = rtl::OUString( READWRITE_SERVICE_NAME  );
     369                 :         34 :     return aNames;
     370                 :            : }
     371                 :            : 
     372                 :            : //=========================================================================
     373                 :            : //
     374                 :            : // Non-interface methods
     375                 :            : //
     376                 :            : //=========================================================================
     377                 :            : 
     378                 :            : uno::Reference< uno::XInterface > SAL_CALL
     379                 :         42 : HierarchyDataSource::createInstanceWithArguments(
     380                 :            :                                 const rtl::OUString & ServiceSpecifier,
     381                 :            :                                 const uno::Sequence< uno::Any > & Arguments,
     382                 :            :                                 bool bCheckArgs )
     383                 :            :     throw ( uno::Exception, uno::RuntimeException )
     384                 :            : {
     385         [ +  - ]:         42 :     osl::Guard< osl::Mutex > aGuard( m_aMutex );
     386                 :            : 
     387                 :            :     // Check service specifier.
     388                 :         42 :     bool bReadOnly  = ServiceSpecifier == READ_SERVICE_NAME;
     389 [ +  - ][ +  + ]:         42 :     bool bReadWrite = !bReadOnly && ServiceSpecifier == READWRITE_SERVICE_NAME;
     390                 :            : 
     391 [ +  + ][ -  + ]:         42 :     if ( !bReadOnly && !bReadWrite )
     392                 :            :     {
     393                 :            :         OSL_FAIL( "HierarchyDataSource::createInstanceWithArguments - "
     394                 :            :                     "Unsupported service specifier!" );
     395                 :          0 :         return uno::Reference< uno::XInterface >();
     396                 :            :     }
     397                 :            : 
     398         [ +  - ]:         42 :     uno::Sequence< uno::Any > aNewArgs( Arguments );
     399                 :            : 
     400                 :         42 :     bool bHasLazyWriteProp = bReadOnly; // property must be added only if
     401                 :            :                                         // a writable view is requested.
     402         [ +  + ]:         42 :     if ( bCheckArgs )
     403                 :            :     {
     404                 :            :         // Check arguments.
     405                 :         38 :         bool bHasNodePath = false;
     406                 :         38 :         sal_Int32 nCount = Arguments.getLength();
     407         [ +  + ]:         76 :         for ( sal_Int32 n = 0; n < nCount; ++n )
     408                 :            :         {
     409                 :         38 :             beans::PropertyValue aProp;
     410 [ +  - ][ +  - ]:         38 :             if ( Arguments[ n ] >>= aProp )
     411                 :            :             {
     412         [ +  - ]:         38 :                 if ( aProp.Name == CFGPROPERTY_NODEPATH )
     413                 :            :                 {
     414                 :         38 :                     rtl::OUString aPath;
     415         [ +  - ]:         38 :                     if ( aProp.Value >>= aPath )
     416                 :            :                     {
     417                 :         38 :                         bHasNodePath = true;
     418                 :            : 
     419                 :            :                         // Create path to data inside the configuration.
     420                 :         38 :                         rtl::OUString aConfigPath;
     421 [ -  + ][ +  - ]:         38 :                         if ( !createConfigPath( aPath, aConfigPath ) )
     422                 :            :                         {
     423                 :            :                             OSL_FAIL( "HierarchyDataSource::"
     424                 :            :                                 "createInstanceWithArguments - "
     425                 :            :                                 "Invalid node path!" );
     426                 :          0 :                             return uno::Reference< uno::XInterface >();
     427                 :            :                         }
     428                 :            : 
     429         [ +  - ]:         38 :                         aProp.Value <<= aConfigPath;
     430                 :            : 
     431                 :            :                         // Set new path in arguments.
     432 [ +  - ][ +  - ]:         38 :                         aNewArgs[ n ] <<= aProp;
     433                 :            : 
     434         [ +  + ]:         38 :                         if ( bHasLazyWriteProp )
     435      [ +  -  + ]:         38 :                             break;
     436                 :            :                     }
     437                 :            :                     else
     438                 :            :                     {
     439                 :            :                         OSL_FAIL( "HierarchyDataSource::createInstanceWithArguments - "
     440                 :            :                             "Invalid type for property 'nodepath'!" );
     441                 :          0 :                         return uno::Reference< uno::XInterface >();
     442      [ +  -  + ]:         38 :                     }
     443                 :            :                 }
     444         [ #  # ]:          0 :                 else if ( aProp.Name == CFGPROPERTY_LAZYWRITE )
     445                 :            :                 {
     446 [ #  # ][ #  # ]:          0 :                     if ( aProp.Value.getValueType() == getCppuBooleanType() )
     447                 :            :                     {
     448                 :          0 :                         bHasLazyWriteProp = true;
     449                 :            : 
     450         [ #  # ]:          0 :                         if ( bHasNodePath )
     451                 :            :                             break;
     452                 :            :                     }
     453                 :            :                     else
     454                 :            :                     {
     455                 :            :                         OSL_FAIL( "HierarchyDataSource::createInstanceWithArguments - "
     456                 :            :                             "Invalid type for property 'lazywrite'!" );
     457                 :         36 :                         return uno::Reference< uno::XInterface >();
     458                 :            :                     }
     459                 :            :                 }
     460                 :            :             }
     461      [ +  -  + ]:         38 :         }
     462                 :            : 
     463         [ -  + ]:         38 :         if ( !bHasNodePath )
     464                 :            :         {
     465                 :            :             OSL_FAIL( "HierarchyDataSource::createInstanceWithArguments - "
     466                 :            :                         "No 'nodepath' property!" );
     467                 :          0 :             return uno::Reference< uno::XInterface >();
     468                 :            :         }
     469                 :            :     }
     470                 :            : 
     471                 :            :     // Create Configuration Provider.
     472         [ +  - ]:         42 :     uno::Reference< lang::XMultiServiceFactory > xProv = getConfigProvider();
     473         [ -  + ]:         42 :     if ( !xProv.is() )
     474                 :          0 :         return uno::Reference< uno::XInterface >();
     475                 :            : 
     476                 :         42 :     uno::Reference< uno::XInterface > xConfigAccess;
     477                 :            :     try
     478                 :            :     {
     479         [ +  + ]:         42 :         if ( bReadOnly )
     480                 :            :         {
     481                 :            :             // Create configuration read-only access object.
     482         [ +  - ]:          4 :             xConfigAccess = xProv->createInstanceWithArguments(
     483                 :            :                                 rtl::OUString( CONFIG_READ_SERVICE_NAME  ),
     484 [ +  - ][ +  - ]:          4 :                                 aNewArgs );
     485                 :            :         }
     486                 :            :         else
     487                 :            :         {
     488                 :            :             // Append 'lazywrite' property value, if not already present.
     489         [ +  - ]:         38 :             if ( !bHasLazyWriteProp )
     490                 :            :             {
     491                 :         38 :                 sal_Int32 nLen = aNewArgs.getLength();
     492         [ +  - ]:         38 :                 aNewArgs.realloc( nLen + 1 );
     493                 :            : 
     494                 :         38 :                 beans::PropertyValue aProp;
     495                 :         38 :                 aProp.Name = rtl::OUString( CFGPROPERTY_LAZYWRITE  );
     496         [ +  - ]:         38 :                 aProp.Value <<= sal_True;
     497 [ +  - ][ +  - ]:         38 :                 aNewArgs[ nLen ] <<= aProp;
     498                 :            :             }
     499                 :            : 
     500                 :            :             // Create configuration read-write access object.
     501         [ +  - ]:         38 :             xConfigAccess = xProv->createInstanceWithArguments(
     502                 :            :                                 rtl::OUString( CONFIG_READWRITE_SERVICE_NAME  ),
     503 [ +  - ][ +  - ]:         38 :                                 aNewArgs );
     504                 :            :         }
     505                 :            :     }
     506         [ #  # ]:          0 :     catch ( uno::Exception const & )
     507                 :            :     {
     508                 :            :         OSL_FAIL( "HierarchyDataSource::createInstanceWithArguments - "
     509                 :            :                     "Cannot instanciate configuration access!" );
     510                 :          0 :         throw;
     511                 :            :     }
     512                 :            : 
     513         [ -  + ]:         42 :     if ( !xConfigAccess.is() )
     514                 :            :     {
     515                 :            :         OSL_FAIL( "HierarchyDataSource::createInstanceWithArguments - "
     516                 :            :                     "Cannot instanciate configuration access!" );
     517                 :          0 :         return xConfigAccess;
     518                 :            :     }
     519                 :            : 
     520                 :            :     return uno::Reference< uno::XInterface >(
     521                 :            :                 static_cast< cppu::OWeakObject * >(
     522 [ +  - ][ +  - ]:         42 :                     new HierarchyDataAccess( xConfigAccess, bReadOnly ) ) );
         [ +  - ][ +  - ]
     523                 :            : }
     524                 :            : 
     525                 :            : //=========================================================================
     526                 :            : uno::Reference< lang::XMultiServiceFactory >
     527                 :         42 : HierarchyDataSource::getConfigProvider()
     528                 :            : {
     529         [ +  + ]:         42 :     if ( !m_xConfigProvider.is() )
     530                 :            :     {
     531         [ +  - ]:          4 :         osl::Guard< osl::Mutex > aGuard( m_aMutex );
     532         [ +  - ]:          4 :         if ( !m_xConfigProvider.is() )
     533                 :            :         {
     534                 :            :             try
     535                 :            :             {
     536                 :            :                 m_xConfigProvider
     537                 :            :                     = uno::Reference< lang::XMultiServiceFactory >(
     538         [ +  - ]:          4 :                         m_xSMgr->createInstance(
     539                 :          4 :                             rtl::OUString( CONFIG_PROVIDER_SERVICE_NAME  ) ),
     540 [ +  - ][ +  - ]:          4 :                         uno::UNO_QUERY );
         [ +  - ][ #  # ]
     541                 :            : 
     542                 :            :                 OSL_ENSURE( m_xConfigProvider.is(),
     543                 :            :                             "HierarchyDataSource::getConfigProvider - "
     544                 :            :                             "No configuration provider!" );
     545                 :            :             }
     546         [ #  # ]:          0 :             catch ( uno::Exception const & )
     547                 :            :             {
     548                 :            :                 OSL_FAIL( "HierarchyDataSource::getConfigProvider - "
     549                 :            :                                "caught exception!" );
     550                 :            :             }
     551         [ +  - ]:          4 :         }
     552                 :            :     }
     553                 :            : 
     554                 :         42 :     return m_xConfigProvider;
     555                 :            : }
     556                 :            : 
     557                 :            : //=========================================================================
     558                 :         38 : bool HierarchyDataSource::createConfigPath(
     559                 :            :                 const rtl::OUString & rInPath, rtl::OUString & rOutPath )
     560                 :            : {
     561         [ +  + ]:         38 :     if ( !rInPath.isEmpty() )
     562                 :            :     {
     563         [ -  + ]:         34 :         if ( rInPath.indexOf( '/' ) == 0 )
     564                 :            :         {
     565                 :            :             OSL_FAIL( "HierarchyDataSource::createConfigPath - "
     566                 :            :                         "Leading slash in node path!" );
     567                 :          0 :             return false;
     568                 :            :         }
     569                 :            : 
     570         [ -  + ]:         34 :         if ( rInPath.lastIndexOf( '/' ) == rInPath.getLength() - 1 )
     571                 :            :         {
     572                 :            :             OSL_FAIL( "HierarchyDataSource::createConfigPath - "
     573                 :            :                         "Trailing slash in node path!" );
     574                 :          0 :             return false;
     575                 :            :         }
     576                 :            : 
     577                 :            :         rtl::OUString aOutPath(
     578                 :         34 :                  CONFIG_DATA_ROOT_KEY "/"  );
     579                 :         34 :         aOutPath += rInPath;
     580                 :         34 :         rOutPath = aOutPath;
     581                 :            :     }
     582                 :            :     else
     583                 :            :     {
     584                 :          4 :         rOutPath = rtl::OUString( CONFIG_DATA_ROOT_KEY  );
     585                 :            :     }
     586                 :            : 
     587                 :         38 :     return true;
     588                 :            : }
     589                 :            : 
     590                 :            : //=========================================================================
     591                 :            : //=========================================================================
     592                 :            : //
     593                 :            : // HierarchyDataAccess Implementation.
     594                 :            : //
     595                 :            : //=========================================================================
     596                 :            : //=========================================================================
     597                 :            : 
     598                 :            : #define ENSURE_ORIG_INTERFACE( interface_name, member_name )    \
     599                 :            :     m_xCfg##member_name;                                        \
     600                 :            :     if ( !m_xCfg##member_name.is() )                            \
     601                 :            :     {                                                           \
     602                 :            :         osl::Guard< osl::Mutex > aGuard( m_aMutex );            \
     603                 :            :         if ( !m_xCfg##member_name.is() )                        \
     604                 :            :             m_xCfg##member_name                                 \
     605                 :            :                 = uno::Reference< interface_name >(             \
     606                 :            :                     m_xConfigAccess, uno::UNO_QUERY );          \
     607                 :            :         xOrig = m_xCfg##member_name;                            \
     608                 :            :     }
     609                 :            : 
     610                 :            : //=========================================================================
     611                 :         42 : HierarchyDataAccess::HierarchyDataAccess( const uno::Reference<
     612                 :            :                                             uno::XInterface > & xConfigAccess,
     613                 :            :                                           bool bReadOnly )
     614                 :            : : m_xConfigAccess( xConfigAccess ),
     615         [ +  - ]:         42 :   m_bReadOnly( bReadOnly )
     616                 :            : {
     617                 :         42 : }
     618                 :            : 
     619                 :            : //=========================================================================
     620                 :            : // virtual
     621         [ +  - ]:         42 : HierarchyDataAccess::~HierarchyDataAccess()
     622                 :            : {
     623         [ -  + ]:         84 : }
     624                 :            : 
     625                 :            : //=========================================================================
     626                 :            : //
     627                 :            : // XInterface methods.
     628                 :            : //
     629                 :            : //=========================================================================
     630                 :            : 
     631                 :       1200 : XINTERFACE_COMMON_IMPL( HierarchyDataAccess );
     632                 :            : 
     633                 :            : //=========================================================================
     634                 :            : // virtual
     635                 :         82 : uno::Any SAL_CALL HierarchyDataAccess::queryInterface( const uno::Type & aType )
     636                 :            :     throw ( uno::RuntimeException )
     637                 :            : {
     638                 :            :     // Interfaces supported in read-only and read-write mode.
     639                 :            :     uno::Any aRet = cppu::queryInterface( aType,
     640                 :            :                 static_cast< lang::XTypeProvider * >( this ),
     641                 :            :                 static_cast< lang::XServiceInfo * >( this ),
     642                 :            :                 static_cast< lang::XComponent * >( this ),
     643                 :            :                 static_cast< container::XHierarchicalNameAccess * >( this ),
     644                 :            :                 static_cast< container::XNameAccess * >( this ),
     645                 :            :                 static_cast< container::XElementAccess * >( this ),
     646         [ +  - ]:         82 :                 static_cast< util::XChangesNotifier * >( this ) );
     647                 :            : 
     648                 :            :     // Interfaces supported only in read-write mode.
     649 [ +  + ][ +  + ]:         82 :     if ( !aRet.hasValue() && !m_bReadOnly )
                 [ +  + ]
     650                 :            :     {
     651                 :            :         aRet = cppu::queryInterface( aType,
     652                 :            :                 static_cast< lang::XSingleServiceFactory * >( this ),
     653                 :            :                 static_cast< container::XNameContainer * >( this ),
     654                 :            :                 static_cast< container::XNameReplace * >( this ),
     655         [ +  - ]:         42 :                 static_cast< util::XChangesBatch * >( this ) );
     656                 :            :     }
     657                 :            : 
     658 [ +  + ][ +  - ]:         82 :     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( aType );
     659                 :            : }
     660                 :            : 
     661                 :            : //=========================================================================
     662                 :            : //
     663                 :            : // XTypeProvider methods.
     664                 :            : //
     665                 :            : //=========================================================================
     666                 :            : 
     667 [ #  # ][ #  # ]:          0 : XTYPEPROVIDER_COMMON_IMPL( HierarchyDataAccess );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     668                 :            : 
     669                 :            : //=========================================================================
     670                 :            : // virtual
     671                 :          0 : uno::Sequence< uno::Type > SAL_CALL HierarchyDataAccess::getTypes()
     672                 :            :     throw( uno::RuntimeException )
     673                 :            : {
     674                 :          0 :     cppu::OTypeCollection * pCollection = 0;
     675                 :            : 
     676         [ #  # ]:          0 :     if ( m_bReadOnly )
     677                 :            :     {
     678                 :            :         static cppu::OTypeCollection* pReadOnlyTypes = 0;
     679                 :            : 
     680                 :          0 :         pCollection = pReadOnlyTypes;
     681         [ #  # ]:          0 :         if ( !pCollection )
     682                 :            :         {
     683 [ #  # ][ #  # ]:          0 :             osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
     684                 :            : 
     685                 :          0 :             pCollection = pReadOnlyTypes;
     686         [ #  # ]:          0 :             if ( !pCollection )
     687                 :            :             {
     688                 :            :                 static cppu::OTypeCollection aCollection(
     689         [ #  # ]:          0 :                     CPPU_TYPE_REF( lang::XTypeProvider ),
     690         [ #  # ]:          0 :                     CPPU_TYPE_REF( lang::XServiceInfo ),
     691         [ #  # ]:          0 :                     CPPU_TYPE_REF( lang::XComponent ),
     692         [ #  # ]:          0 :                     CPPU_TYPE_REF( container::XHierarchicalNameAccess ),
     693         [ #  # ]:          0 :                     CPPU_TYPE_REF( container::XNameAccess ),
     694 [ #  # ][ #  # ]:          0 :                     CPPU_TYPE_REF( util::XChangesNotifier ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     695                 :          0 :                 pCollection = &aCollection;
     696                 :            :                 OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
     697                 :          0 :                 pReadOnlyTypes = pCollection;
     698         [ #  # ]:          0 :             }
     699                 :            :         }
     700                 :            :         else {
     701                 :            :             OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
     702                 :            :         }
     703                 :            :     }
     704                 :            :     else
     705                 :            :     {
     706                 :            :         static cppu::OTypeCollection* pReadWriteTypes = 0;
     707                 :            : 
     708                 :          0 :         pCollection = pReadWriteTypes;
     709         [ #  # ]:          0 :         if ( !pCollection )
     710                 :            :         {
     711 [ #  # ][ #  # ]:          0 :             osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
     712                 :            : 
     713                 :          0 :             pCollection = pReadWriteTypes;
     714         [ #  # ]:          0 :             if ( !pCollection )
     715                 :            :             {
     716                 :            :                 static cppu::OTypeCollection aCollection(
     717         [ #  # ]:          0 :                     CPPU_TYPE_REF( lang::XTypeProvider ),
     718         [ #  # ]:          0 :                     CPPU_TYPE_REF( lang::XServiceInfo ),
     719         [ #  # ]:          0 :                     CPPU_TYPE_REF( lang::XComponent ),
     720         [ #  # ]:          0 :                     CPPU_TYPE_REF( lang::XSingleServiceFactory ),
     721         [ #  # ]:          0 :                     CPPU_TYPE_REF( container::XHierarchicalNameAccess ),
     722         [ #  # ]:          0 :                     CPPU_TYPE_REF( container::XNameContainer ),
     723         [ #  # ]:          0 :                     CPPU_TYPE_REF( util::XChangesBatch ),
     724 [ #  # ][ #  # ]:          0 :                     CPPU_TYPE_REF( util::XChangesNotifier ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     725                 :          0 :                 pCollection = &aCollection;
     726                 :            :                 OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
     727                 :          0 :                 pReadWriteTypes = pCollection;
     728         [ #  # ]:          0 :             }
     729                 :            :         }
     730                 :            :         else {
     731                 :            :             OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
     732                 :            :         }
     733                 :            :     }
     734                 :            : 
     735                 :          0 :     return (*pCollection).getTypes();
     736                 :            : }
     737                 :            : 
     738                 :            : //=========================================================================
     739                 :            : //
     740                 :            : // XServiceInfo methods.
     741                 :            : //
     742                 :            : //=========================================================================
     743                 :            : 
     744 [ #  # ][ #  # ]:          0 : XSERVICEINFO_NOFACTORY_IMPL_0(
         [ #  # ][ #  # ]
                 [ #  # ]
     745                 :            :         HierarchyDataAccess,
     746                 :            :         rtl::OUString( "com.sun.star.comp.ucb.HierarchyDataAccess"  ) )
     747                 :            : {
     748                 :          0 :     uno::Sequence< rtl::OUString > aSNS( 2 );
     749         [ #  # ]:          0 :     aSNS[ 0 ] = rtl::OUString( READ_SERVICE_NAME  );
     750         [ #  # ]:          0 :     aSNS[ 1 ] = rtl::OUString( READWRITE_SERVICE_NAME  );
     751                 :          0 :     return aSNS;
     752                 :            : }
     753                 :            : 
     754                 :            : //=========================================================================
     755                 :            : //
     756                 :            : // XComponent methods.
     757                 :            : //
     758                 :            : //=========================================================================
     759                 :            : 
     760                 :            : // virtual
     761                 :          0 : void SAL_CALL HierarchyDataAccess::dispose()
     762                 :            :     throw ( uno::RuntimeException )
     763                 :            : {
     764                 :            :     uno::Reference< lang::XComponent > xOrig
     765 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( lang::XComponent, C );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     766                 :            : 
     767                 :            :     OSL_ENSURE( xOrig.is(),
     768                 :            :                 "HierarchyDataAccess : Data source is not an XComponent!" );
     769 [ #  # ][ #  # ]:          0 :     xOrig->dispose();
     770                 :          0 : }
     771                 :            : 
     772                 :            : //=========================================================================
     773                 :            : // virtual
     774                 :          0 : void SAL_CALL HierarchyDataAccess::addEventListener(
     775                 :            :                     const uno::Reference< lang::XEventListener > & xListener )
     776                 :            :     throw ( uno::RuntimeException )
     777                 :            : {
     778                 :            :     uno::Reference< lang::XComponent > xOrig
     779 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( lang::XComponent, C );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     780                 :            : 
     781                 :            :     OSL_ENSURE( xOrig.is(),
     782                 :            :                 "HierarchyDataAccess : Data source is not an XComponent!" );
     783 [ #  # ][ #  # ]:          0 :     xOrig->addEventListener( xListener );
     784                 :          0 : }
     785                 :            : 
     786                 :            : //=========================================================================
     787                 :            : // virtual
     788                 :          0 : void SAL_CALL HierarchyDataAccess::removeEventListener(
     789                 :            :                     const uno::Reference< lang::XEventListener > & aListener )
     790                 :            :     throw ( uno::RuntimeException )
     791                 :            : {
     792                 :            :     uno::Reference< lang::XComponent > xOrig
     793 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( lang::XComponent, C );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     794                 :            : 
     795                 :            :     OSL_ENSURE( xOrig.is(),
     796                 :            :                 "HierarchyDataAccess : Data source is not an XComponent!" );
     797 [ #  # ][ #  # ]:          0 :     xOrig->removeEventListener( aListener );
     798                 :          0 : }
     799                 :            : 
     800                 :            : //=========================================================================
     801                 :            : //
     802                 :            : // XHierarchicalNameAccess methods.
     803                 :            : //
     804                 :            : //=========================================================================
     805                 :            : 
     806                 :            : // virtual
     807                 :         28 : uno::Any SAL_CALL HierarchyDataAccess::getByHierarchicalName(
     808                 :            :                                                 const rtl::OUString & aName )
     809                 :            :     throw ( container::NoSuchElementException, uno::RuntimeException )
     810                 :            : {
     811                 :            :     uno::Reference< container::XHierarchicalNameAccess > xOrig
     812 [ -  + ][ #  # ]:         28 :         = ENSURE_ORIG_INTERFACE( container::XHierarchicalNameAccess, HNA );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     813                 :            : 
     814                 :            :     OSL_ENSURE( xOrig.is(),
     815                 :            :                 "HierarchyDataAccess : "
     816                 :            :                 "Data source is not an XHierarchicalNameAccess!" );
     817 [ +  - ][ +  - ]:         28 :     return xOrig->getByHierarchicalName( aName );
     818                 :            : }
     819                 :            : 
     820                 :            : //=========================================================================
     821                 :            : // virtual
     822                 :         86 : sal_Bool SAL_CALL HierarchyDataAccess::hasByHierarchicalName(
     823                 :            :                                                 const rtl::OUString & aName )
     824                 :            :     throw ( uno::RuntimeException )
     825                 :            : {
     826                 :            :     uno::Reference< container::XHierarchicalNameAccess > xOrig
     827 [ +  + ][ +  - ]:         86 :         = ENSURE_ORIG_INTERFACE( container::XHierarchicalNameAccess, HNA );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     828                 :            : 
     829                 :            :     OSL_ENSURE( xOrig.is(),
     830                 :            :                 "HierarchyDataAccess : "
     831                 :            :                 "Data source is not an XHierarchicalNameAccess!" );
     832 [ +  - ][ +  - ]:         86 :     return xOrig->hasByHierarchicalName( aName );
     833                 :            : }
     834                 :            : 
     835                 :            : //=========================================================================
     836                 :            : //
     837                 :            : // XNameAccess methods.
     838                 :            : //
     839                 :            : //=========================================================================
     840                 :            : 
     841                 :            : // virtual
     842                 :         62 : uno::Any SAL_CALL HierarchyDataAccess::getByName( const rtl::OUString & aName )
     843                 :            :     throw ( container::NoSuchElementException,
     844                 :            :             lang::WrappedTargetException,
     845                 :            :             uno::RuntimeException )
     846                 :            : {
     847                 :            :     uno::Reference< container::XNameAccess > xOrig
     848 [ +  + ][ +  - ]:         62 :         = ENSURE_ORIG_INTERFACE( container::XNameAccess, NA );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     849                 :            : 
     850                 :            :     OSL_ENSURE( xOrig.is(),
     851                 :            :                 "HierarchyDataAccess : Data source is not an XNameAccess!" );
     852 [ +  - ][ +  - ]:         62 :     return xOrig->getByName( aName );
     853                 :            : }
     854                 :            : 
     855                 :            : //=========================================================================
     856                 :            : // virtual
     857                 :          0 : uno::Sequence< rtl::OUString > SAL_CALL HierarchyDataAccess::getElementNames()
     858                 :            :     throw ( uno::RuntimeException )
     859                 :            : {
     860                 :            :     uno::Reference< container::XNameAccess > xOrig
     861 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( container::XNameAccess, NA );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     862                 :            : 
     863                 :            :     OSL_ENSURE( xOrig.is(),
     864                 :            :                 "HierarchyDataAccess : Data source is not an XNameAccess!" );
     865 [ #  # ][ #  # ]:          0 :     return xOrig->getElementNames();
     866                 :            : }
     867                 :            : 
     868                 :            : //=========================================================================
     869                 :            : // virtual
     870                 :          2 : sal_Bool SAL_CALL HierarchyDataAccess::hasByName( const rtl::OUString & aName )
     871                 :            :     throw ( uno::RuntimeException )
     872                 :            : {
     873                 :            :     uno::Reference< container::XNameAccess > xOrig
     874 [ +  - ][ +  - ]:          2 :         = ENSURE_ORIG_INTERFACE( container::XNameAccess, NA );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     875                 :            : 
     876                 :            :     OSL_ENSURE( xOrig.is(),
     877                 :            :                 "HierarchyDataAccess : Data source is not an XNameAccess!" );
     878 [ +  - ][ +  - ]:          2 :     return xOrig->hasByName( aName );
     879                 :            : }
     880                 :            : 
     881                 :            : //=========================================================================
     882                 :            : //
     883                 :            : // XElementAccess methods.
     884                 :            : //
     885                 :            : //=========================================================================
     886                 :            : 
     887                 :            : // virtual
     888                 :          0 : uno::Type SAL_CALL HierarchyDataAccess::getElementType()
     889                 :            :     throw ( uno::RuntimeException )
     890                 :            : {
     891                 :            :     uno::Reference< container::XElementAccess > xOrig
     892 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( container::XElementAccess, EA );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     893                 :            : 
     894                 :            :     OSL_ENSURE( xOrig.is(),
     895                 :            :                 "HierarchyDataAccess : Data source is not an XElementAccess!" );
     896 [ #  # ][ #  # ]:          0 :     return xOrig->getElementType();
     897                 :            : }
     898                 :            : 
     899                 :            : //=========================================================================
     900                 :            : // virtual
     901                 :          0 : sal_Bool SAL_CALL HierarchyDataAccess::hasElements()
     902                 :            :     throw ( uno::RuntimeException )
     903                 :            : {
     904                 :            :     uno::Reference< container::XElementAccess > xOrig
     905 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( container::XElementAccess, EA );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     906                 :            : 
     907                 :            :     OSL_ENSURE( xOrig.is(),
     908                 :            :                 "HierarchyDataAccess : Data source is not an XElementAccess!" );
     909 [ #  # ][ #  # ]:          0 :     return xOrig->hasElements();
     910                 :            : }
     911                 :            : 
     912                 :            : //=========================================================================
     913                 :            : //
     914                 :            : // XChangesNotifier methods.
     915                 :            : //
     916                 :            : //=========================================================================
     917                 :            : 
     918                 :            : // virtual
     919                 :          0 : void SAL_CALL HierarchyDataAccess::addChangesListener(
     920                 :            :                 const uno::Reference< util::XChangesListener > & aListener )
     921                 :            :     throw ( uno::RuntimeException )
     922                 :            : {
     923                 :            :     uno::Reference< util::XChangesNotifier > xOrig
     924 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( util::XChangesNotifier, CN );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     925                 :            : 
     926                 :            :     OSL_ENSURE( xOrig.is(),
     927                 :            :             "HierarchyDataAccess : Data source is not an XChangesNotifier!" );
     928 [ #  # ][ #  # ]:          0 :     xOrig->addChangesListener( aListener );
     929                 :          0 : }
     930                 :            : 
     931                 :            : //=========================================================================
     932                 :            : // virtual
     933                 :          0 : void SAL_CALL HierarchyDataAccess::removeChangesListener(
     934                 :            :                 const uno::Reference< util::XChangesListener > & aListener )
     935                 :            :     throw ( uno::RuntimeException )
     936                 :            : {
     937                 :            :     uno::Reference< util::XChangesNotifier > xOrig
     938 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( util::XChangesNotifier, CN );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     939                 :            : 
     940                 :            :     OSL_ENSURE( xOrig.is(),
     941                 :            :             "HierarchyDataAccess : Data source is not an XChangesNotifier!" );
     942 [ #  # ][ #  # ]:          0 :     xOrig->removeChangesListener( aListener );
     943                 :          0 : }
     944                 :            : 
     945                 :            : //=========================================================================
     946                 :            : //
     947                 :            : // XSingleServiceFactory methods.
     948                 :            : //
     949                 :            : //=========================================================================
     950                 :            : 
     951                 :            : // virtual
     952                 :          2 : uno::Reference< uno::XInterface > SAL_CALL HierarchyDataAccess::createInstance()
     953                 :            :     throw ( uno::Exception, uno::RuntimeException )
     954                 :            : {
     955                 :            :     uno::Reference< lang::XSingleServiceFactory > xOrig
     956 [ +  - ][ +  - ]:          2 :         = ENSURE_ORIG_INTERFACE( lang::XSingleServiceFactory, SSF );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     957                 :            : 
     958                 :            :     OSL_ENSURE( xOrig.is(),
     959                 :            :         "HierarchyDataAccess : Data source is not an XSingleServiceFactory!" );
     960 [ +  - ][ +  - ]:          2 :     return xOrig->createInstance();
     961                 :            : }
     962                 :            : 
     963                 :            : //=========================================================================
     964                 :            : // virtual
     965                 :            : uno::Reference< uno::XInterface > SAL_CALL
     966                 :          0 : HierarchyDataAccess::createInstanceWithArguments(
     967                 :            :                             const uno::Sequence< uno::Any > & aArguments )
     968                 :            :     throw ( uno::Exception, uno::RuntimeException )
     969                 :            : {
     970                 :            :     uno::Reference< lang::XSingleServiceFactory > xOrig
     971 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( lang::XSingleServiceFactory, SSF );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     972                 :            : 
     973                 :            :     OSL_ENSURE( xOrig.is(),
     974                 :            :         "HierarchyDataAccess : Data source is not an XSingleServiceFactory!" );
     975 [ #  # ][ #  # ]:          0 :     return xOrig->createInstanceWithArguments( aArguments );
     976                 :            : }
     977                 :            : 
     978                 :            : //=========================================================================
     979                 :            : //
     980                 :            : // XNameContainer methods.
     981                 :            : //
     982                 :            : //=========================================================================
     983                 :            : 
     984                 :            : // virtual
     985                 :            : void SAL_CALL
     986                 :          2 : HierarchyDataAccess::insertByName( const rtl::OUString & aName,
     987                 :            :                                    const uno::Any & aElement )
     988                 :            :     throw ( lang::IllegalArgumentException,
     989                 :            :             container::ElementExistException,
     990                 :            :             lang::WrappedTargetException,
     991                 :            :             uno::RuntimeException )
     992                 :            : {
     993                 :            :     uno::Reference< container::XNameContainer > xOrig
     994 [ +  - ][ +  - ]:          2 :         = ENSURE_ORIG_INTERFACE( container::XNameContainer, NC );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     995                 :            : 
     996                 :            :     OSL_ENSURE( xOrig.is(),
     997                 :            :         "HierarchyDataAccess : Data source is not an XNameContainer!" );
     998 [ +  - ][ +  - ]:          2 :     xOrig->insertByName( aName, aElement );
     999                 :          2 : }
    1000                 :            : 
    1001                 :            : //=========================================================================
    1002                 :            : // virtual
    1003                 :            : void SAL_CALL
    1004                 :          0 : HierarchyDataAccess::removeByName( const rtl::OUString & Name )
    1005                 :            :     throw ( container::NoSuchElementException,
    1006                 :            :             lang::WrappedTargetException,
    1007                 :            :             uno::RuntimeException )
    1008                 :            : {
    1009                 :            :     uno::Reference< container::XNameContainer > xOrig
    1010 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( container::XNameContainer, NC );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1011                 :            : 
    1012                 :            :     OSL_ENSURE( xOrig.is(),
    1013                 :            :         "HierarchyDataAccess : Data source is not an XNameContainer!" );
    1014 [ #  # ][ #  # ]:          0 :     xOrig->removeByName( Name );
    1015                 :          0 : }
    1016                 :            : 
    1017                 :            : //=========================================================================
    1018                 :            : //
    1019                 :            : // XNameReplace methods.
    1020                 :            : //
    1021                 :            : //=========================================================================
    1022                 :            : 
    1023                 :            : // virtual
    1024                 :          0 : void SAL_CALL HierarchyDataAccess::replaceByName( const rtl::OUString & aName,
    1025                 :            :                                                   const uno::Any & aElement )
    1026                 :            :     throw ( lang::IllegalArgumentException,
    1027                 :            :             container::NoSuchElementException,
    1028                 :            :             lang::WrappedTargetException,
    1029                 :            :             uno::RuntimeException )
    1030                 :            : {
    1031                 :            :     uno::Reference< container::XNameReplace > xOrig
    1032 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( container::XNameReplace, NR );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1033                 :            : 
    1034                 :            :     OSL_ENSURE( xOrig.is(),
    1035                 :            :         "HierarchyDataAccess : Data source is not an XNameReplace!" );
    1036 [ #  # ][ #  # ]:          0 :     xOrig->replaceByName( aName, aElement );
    1037                 :          0 : }
    1038                 :            : 
    1039                 :            : //=========================================================================
    1040                 :            : //
    1041                 :            : // XChangesBatch methods.
    1042                 :            : //
    1043                 :            : //=========================================================================
    1044                 :            : 
    1045                 :            : // virtual
    1046                 :         36 : void SAL_CALL HierarchyDataAccess::commitChanges()
    1047                 :            :     throw ( lang::WrappedTargetException, uno::RuntimeException )
    1048                 :            : {
    1049                 :            :     uno::Reference< util::XChangesBatch > xOrig
    1050 [ +  - ][ +  - ]:         36 :         = ENSURE_ORIG_INTERFACE( util::XChangesBatch, CB );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    1051                 :            : 
    1052                 :            :     OSL_ENSURE( xOrig.is(),
    1053                 :            :         "HierarchyDataAccess : Data source is not an XChangesBatch!" );
    1054 [ +  - ][ +  - ]:         36 :     xOrig->commitChanges();
    1055                 :         36 : }
    1056                 :            : 
    1057                 :            : //=========================================================================
    1058                 :            : // virtual
    1059                 :          0 : sal_Bool SAL_CALL HierarchyDataAccess::hasPendingChanges()
    1060                 :            :     throw ( uno::RuntimeException )
    1061                 :            : {
    1062                 :            :     uno::Reference< util::XChangesBatch > xOrig
    1063 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( util::XChangesBatch, CB );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1064                 :            : 
    1065                 :            :     OSL_ENSURE( xOrig.is(),
    1066                 :            :         "HierarchyDataAccess : Data source is not an XChangesBatch!" );
    1067 [ #  # ][ #  # ]:          0 :     return xOrig->hasPendingChanges();
    1068                 :            : }
    1069                 :            : 
    1070                 :            : //=========================================================================
    1071                 :            : // virtual
    1072                 :            : uno::Sequence< util::ElementChange > SAL_CALL
    1073                 :          0 : HierarchyDataAccess::getPendingChanges()
    1074                 :            :     throw ( uno::RuntimeException )
    1075                 :            : {
    1076                 :            :     uno::Reference< util::XChangesBatch > xOrig
    1077 [ #  # ][ #  # ]:          0 :         = ENSURE_ORIG_INTERFACE( util::XChangesBatch, CB );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1078                 :            : 
    1079                 :            :     OSL_ENSURE( xOrig.is(),
    1080                 :            :         "HierarchyDataAccess : Data source is not an XChangesBatch!" );
    1081 [ #  # ][ #  # ]:          0 :     return xOrig->getPendingChanges();
    1082                 :            : }
    1083                 :            : 
    1084                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10