LCOV - code coverage report
Current view: top level - comphelper/source/property - MasterPropertySet.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 57 216 26.4 %
Date: 2012-08-25 Functions: 7 29 24.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 61 388 15.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : 
      21                 :            : #include <comphelper/MasterPropertySet.hxx>
      22                 :            : #include <comphelper/MasterPropertySetInfo.hxx>
      23                 :            : #include <comphelper/ChainablePropertySet.hxx>
      24                 :            : #include <comphelper/ChainablePropertySetInfo.hxx>
      25                 :            : #include <osl/mutex.hxx>
      26                 :            : 
      27                 :            : #include <boost/scoped_ptr.hpp>
      28                 :            : 
      29                 :            : //////////////////////////////////////////////////////////////////////
      30                 :            : 
      31                 :            : class AutoOGuardArray
      32                 :            : {
      33                 :            :     sal_Int32                       nSize;
      34                 :            :     boost::scoped_ptr< osl::SolarGuard > *  pGuardArray;
      35                 :            : 
      36                 :            : public:
      37                 :            :     AutoOGuardArray( sal_Int32 nNumElements );
      38                 :            :     ~AutoOGuardArray();
      39                 :            : 
      40                 :          0 :     boost::scoped_ptr< osl::SolarGuard > &  operator[] ( sal_Int32 i ) { return pGuardArray[i]; }
      41                 :            : };
      42                 :            : 
      43                 :          0 : AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements )
      44                 :            : {
      45                 :          0 :     nSize       = nNumElements;
      46         [ #  # ]:          0 :     pGuardArray = new boost::scoped_ptr< osl::SolarGuard >[ nSize ];
      47                 :          0 : }
      48                 :            : 
      49                 :          0 : AutoOGuardArray::~AutoOGuardArray()
      50                 :            : {
      51                 :            :     //!! release auto_ptr's and thus the mutexes locks
      52 [ #  # ][ #  # ]:          0 :     delete [] pGuardArray;
      53                 :            : 
      54                 :          0 : }
      55                 :            : 
      56                 :            : //////////////////////////////////////////////////////////////////////
      57                 :            : 
      58                 :            : using namespace ::rtl;
      59                 :            : using namespace ::comphelper;
      60                 :            : using namespace ::com::sun::star;
      61                 :            : using namespace ::com::sun::star::uno;
      62                 :            : using namespace ::com::sun::star::lang;
      63                 :            : using namespace ::com::sun::star::beans;
      64                 :            : 
      65                 :            : 
      66                 :        748 : SlaveData::SlaveData ( ChainablePropertySet *pSlave)
      67                 :            : : mpSlave ( pSlave )
      68                 :            : , mxSlave ( pSlave )
      69                 :        748 : , mbInit ( sal_False )
      70                 :            : {
      71                 :        748 : }
      72                 :            : 
      73                 :        748 : MasterPropertySet::MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, osl::SolarMutex* pMutex )
      74                 :            :     throw()
      75                 :            : : mpInfo ( pInfo )
      76                 :            : , mpMutex ( pMutex )
      77                 :            : , mnLastId ( 0 )
      78 [ +  - ][ +  - ]:        748 : , mxInfo ( pInfo )
                 [ +  - ]
      79                 :            : {
      80                 :        748 : }
      81                 :            : 
      82                 :        748 : MasterPropertySet::~MasterPropertySet()
      83                 :        748 :     throw()
      84                 :            : {
      85                 :        748 :     SlaveMap::iterator aEnd = maSlaveMap.end(), aIter = maSlaveMap.begin();
      86         [ +  + ]:       1496 :     while (aIter != aEnd )
      87                 :            :     {
      88 [ +  - ][ +  - ]:        748 :         delete (*aIter).second;
      89                 :        748 :         ++aIter;
      90                 :            :     }
      91         [ -  + ]:        748 : }
      92                 :            : 
      93                 :            : // XPropertySet
      94                 :        170 : Reference< XPropertySetInfo > SAL_CALL MasterPropertySet::getPropertySetInfo(  )
      95                 :            :     throw(RuntimeException)
      96                 :            : {
      97                 :        170 :     return mxInfo;
      98                 :            : }
      99                 :            : 
     100                 :        748 : void MasterPropertySet::registerSlave ( ChainablePropertySet *pNewSet )
     101                 :            :     throw()
     102                 :            : {
     103         [ +  - ]:        748 :     maSlaveMap [ ++mnLastId ] = new SlaveData ( pNewSet );
     104                 :        748 :     mpInfo->add ( pNewSet->mpInfo->maMap, mnLastId );
     105                 :        748 : }
     106                 :            : 
     107                 :       5754 : void SAL_CALL MasterPropertySet::setPropertyValue( const ::rtl::OUString& rPropertyName, const Any& rValue )
     108                 :            :     throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
     109                 :            : {
     110                 :            :     // acquire mutex in c-tor and releases it in the d-tor (exception safe!).
     111                 :       5754 :     boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
     112         [ +  - ]:       5754 :     if (mpMutex)
     113 [ +  - ][ +  - ]:       5754 :         pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
                 [ +  - ]
     114                 :            : 
     115         [ +  - ]:       5754 :     PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName );
     116                 :            : 
     117 [ -  + ][ +  - ]:       5754 :     if( aIter == mpInfo->maMap.end())
     118 [ #  # ][ #  # ]:          0 :         throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) );
     119                 :            : 
     120 [ +  - ][ +  + ]:       5754 :     if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours !
     121                 :            :     {
     122         [ +  - ]:       4618 :         _preSetValues();
     123 [ +  - ][ +  - ]:       4618 :         _setSingleValue( *((*aIter).second->mpInfo), rValue );
     124         [ +  - ]:       4618 :         _postSetValues();
     125                 :            :     }
     126                 :            :     else
     127                 :            :     {
     128 [ +  - ][ +  - ]:       1136 :         ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave;
     129                 :            : 
     130                 :            :         // acquire mutex in c-tor and releases it in the d-tor (exception safe!).
     131                 :       1136 :         boost::scoped_ptr< osl::SolarGuard > pMutexGuard2;
     132         [ +  - ]:       1136 :         if (pSlave->mpMutex)
     133 [ +  - ][ +  - ]:       1136 :             pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) );
                 [ +  - ]
     134                 :            : 
     135         [ +  - ]:       1136 :         pSlave->_preSetValues();
     136 [ +  - ][ +  - ]:       1136 :         pSlave->_setSingleValue( *((*aIter).second->mpInfo), rValue );
     137 [ +  - ][ +  - ]:       1136 :         pSlave->_postSetValues();
     138         [ +  - ]:       5754 :     }
     139                 :       5754 : }
     140                 :            : 
     141                 :       1475 : Any SAL_CALL MasterPropertySet::getPropertyValue( const ::rtl::OUString& rPropertyName )
     142                 :            :     throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
     143                 :            : {
     144                 :            :     // acquire mutex in c-tor and releases it in the d-tor (exception safe!).
     145                 :       1475 :     boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
     146         [ +  - ]:       1475 :     if (mpMutex)
     147 [ +  - ][ +  - ]:       1475 :         pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
                 [ +  - ]
     148                 :            : 
     149         [ +  - ]:       1475 :     PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName );
     150                 :            : 
     151 [ -  + ][ +  - ]:       1475 :     if( aIter == mpInfo->maMap.end())
     152 [ #  # ][ #  # ]:          0 :         throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) );
     153                 :            : 
     154                 :       1475 :     Any aAny;
     155 [ +  + ][ +  - ]:       1475 :     if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours !
     156                 :            :     {
     157         [ +  - ]:       1081 :         _preGetValues();
     158 [ +  - ][ +  - ]:       1081 :         _getSingleValue( *((*aIter).second->mpInfo), aAny );
     159         [ +  - ]:       1081 :         _postGetValues();
     160                 :            :     }
     161                 :            :     else
     162                 :            :     {
     163 [ +  - ][ +  - ]:        394 :         ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave;
     164                 :            : 
     165                 :            :         // acquire mutex in c-tor and releases it in the d-tor (exception safe!).
     166                 :        394 :         boost::scoped_ptr< osl::SolarGuard > pMutexGuard2;
     167         [ +  - ]:        394 :         if (pSlave->mpMutex)
     168 [ +  - ][ +  - ]:        394 :             pMutexGuard2.reset( new osl::SolarGuard(pSlave->mpMutex) );
                 [ +  - ]
     169                 :            : 
     170         [ +  - ]:        394 :         pSlave->_preGetValues();
     171 [ +  - ][ +  - ]:        394 :         pSlave->_getSingleValue( *((*aIter).second->mpInfo), aAny );
     172 [ +  - ][ +  - ]:        394 :         pSlave->_postGetValues();
     173                 :            :     }
     174         [ +  - ]:       1475 :     return aAny;
     175                 :            : }
     176                 :            : 
     177                 :          0 : void SAL_CALL MasterPropertySet::addPropertyChangeListener( const ::rtl::OUString&, const Reference< XPropertyChangeListener >& )
     178                 :            :     throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
     179                 :            : {
     180                 :            :     // todo
     181                 :          0 : }
     182                 :            : 
     183                 :          0 : void SAL_CALL MasterPropertySet::removePropertyChangeListener( const ::rtl::OUString&, const Reference< XPropertyChangeListener >& )
     184                 :            :     throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
     185                 :            : {
     186                 :            :     // todo
     187                 :          0 : }
     188                 :            : 
     189                 :          0 : void SAL_CALL MasterPropertySet::addVetoableChangeListener( const ::rtl::OUString&, const Reference< XVetoableChangeListener >& )
     190                 :            :     throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
     191                 :            : {
     192                 :            :     // todo
     193                 :          0 : }
     194                 :            : 
     195                 :          0 : void SAL_CALL MasterPropertySet::removeVetoableChangeListener( const ::rtl::OUString&, const Reference< XVetoableChangeListener >& )
     196                 :            :     throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
     197                 :            : {
     198                 :            :     // todo
     199                 :          0 : }
     200                 :            : 
     201                 :            : // XMultiPropertySet
     202                 :          0 : void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< ::rtl::OUString >& aPropertyNames, const Sequence< Any >& aValues )
     203                 :            :     throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
     204                 :            : {
     205                 :            :     // acquire mutex in c-tor and releases it in the d-tor (exception safe!).
     206                 :          0 :     boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
     207         [ #  # ]:          0 :     if (mpMutex)
     208 [ #  # ][ #  # ]:          0 :         pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
                 [ #  # ]
     209                 :            : 
     210                 :          0 :     const sal_Int32 nCount = aPropertyNames.getLength();
     211                 :            : 
     212         [ #  # ]:          0 :     if( nCount != aValues.getLength() )
     213         [ #  # ]:          0 :         throw IllegalArgumentException();
     214                 :            : 
     215         [ #  # ]:          0 :     if( nCount )
     216                 :            :     {
     217         [ #  # ]:          0 :         _preSetValues();
     218                 :            : 
     219                 :          0 :         const Any * pAny = aValues.getConstArray();
     220                 :          0 :         const OUString * pString = aPropertyNames.getConstArray();
     221         [ #  # ]:          0 :         PropertyDataHash::const_iterator aEnd = mpInfo->maMap.end(), aIter;
     222                 :            : 
     223                 :            :         //!! have an auto_ptr to an array of OGuards in order to have the
     224                 :            :         //!! allocated memory properly freed (exception safe!).
     225                 :            :         //!! Since the array itself has auto_ptrs as members we have to use a
     226                 :            :         //!! helper class 'AutoOGuardArray' in order to have
     227                 :            :         //!! the acquired locks properly released.
     228         [ #  # ]:          0 :         AutoOGuardArray aOGuardArray( nCount );
     229                 :            : 
     230         [ #  # ]:          0 :         for ( sal_Int32 i = 0; i < nCount; ++i, ++pString, ++pAny )
     231                 :            :         {
     232         [ #  # ]:          0 :             aIter = mpInfo->maMap.find ( *pString );
     233         [ #  # ]:          0 :             if ( aIter == aEnd )
     234 [ #  # ][ #  # ]:          0 :                 throw UnknownPropertyException( *pString, static_cast< XPropertySet* >( this ) );
     235                 :            : 
     236 [ #  # ][ #  # ]:          0 :             if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours !
     237 [ #  # ][ #  # ]:          0 :                 _setSingleValue( *((*aIter).second->mpInfo), *pAny );
     238                 :            :             else
     239                 :            :             {
     240 [ #  # ][ #  # ]:          0 :                 SlaveData * pSlave = maSlaveMap [ (*aIter).second->mnMapId ];
     241         [ #  # ]:          0 :                 if (!pSlave->IsInit())
     242                 :            :                 {
     243                 :            :                     // acquire mutex in c-tor and releases it in the d-tor (exception safe!).
     244         [ #  # ]:          0 :                     if (pSlave->mpSlave->mpMutex)
     245 [ #  # ][ #  # ]:          0 :                         aOGuardArray[i].reset( new osl::SolarGuard(pSlave->mpSlave->mpMutex) );
                 [ #  # ]
     246                 :            : 
     247         [ #  # ]:          0 :                     pSlave->mpSlave->_preSetValues();
     248                 :          0 :                     pSlave->SetInit ( sal_True );
     249                 :            :                 }
     250 [ #  # ][ #  # ]:          0 :                 pSlave->mpSlave->_setSingleValue( *((*aIter).second->mpInfo), *pAny );
     251                 :            :             }
     252                 :            :         }
     253                 :            : 
     254         [ #  # ]:          0 :         _postSetValues();
     255                 :          0 :         SlaveMap::const_iterator aSlaveIter = maSlaveMap.begin(), aSlaveEnd = maSlaveMap.end();
     256         [ #  # ]:          0 :         while (aSlaveIter != aSlaveEnd)
     257                 :            :         {
     258         [ #  # ]:          0 :             if ( (*aSlaveIter).second->IsInit())
     259                 :            :             {
     260         [ #  # ]:          0 :                 (*aSlaveIter).second->mpSlave->_postSetValues();
     261                 :          0 :                 (*aSlaveIter).second->SetInit ( sal_False );
     262                 :            :             }
     263                 :          0 :             ++aSlaveIter;
     264         [ #  # ]:          0 :         }
     265         [ #  # ]:          0 :     }
     266                 :          0 : }
     267                 :            : 
     268                 :          0 : Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< ::rtl::OUString >& aPropertyNames )
     269                 :            :     throw(RuntimeException)
     270                 :            : {
     271                 :            :     // acquire mutex in c-tor and releases it in the d-tor (exception safe!).
     272                 :          0 :     boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
     273         [ #  # ]:          0 :     if (mpMutex)
     274 [ #  # ][ #  # ]:          0 :         pMutexGuard.reset( new osl::SolarGuard(mpMutex) );
                 [ #  # ]
     275                 :            : 
     276                 :          0 :     const sal_Int32 nCount = aPropertyNames.getLength();
     277                 :            : 
     278         [ #  # ]:          0 :     Sequence < Any > aValues ( nCount );
     279                 :            : 
     280         [ #  # ]:          0 :     if( nCount )
     281                 :            :     {
     282         [ #  # ]:          0 :         _preGetValues();
     283                 :            : 
     284         [ #  # ]:          0 :         Any * pAny = aValues.getArray();
     285                 :          0 :         const OUString * pString = aPropertyNames.getConstArray();
     286         [ #  # ]:          0 :         PropertyDataHash::const_iterator aEnd = mpInfo->maMap.end(), aIter;
     287                 :            : 
     288                 :            :         //!! have an auto_ptr to an array of OGuards in order to have the
     289                 :            :         //!! allocated memory properly freed (exception safe!).
     290                 :            :         //!! Since the array itself has auto_ptrs as members we have to use a
     291                 :            :         //!! helper class 'AutoOGuardArray' in order to have
     292                 :            :         //!! the acquired locks properly released.
     293         [ #  # ]:          0 :         AutoOGuardArray aOGuardArray( nCount );
     294                 :            : 
     295         [ #  # ]:          0 :         for ( sal_Int32 i = 0; i < nCount; ++i, ++pString, ++pAny )
     296                 :            :         {
     297         [ #  # ]:          0 :             aIter = mpInfo->maMap.find ( *pString );
     298         [ #  # ]:          0 :             if ( aIter == aEnd )
     299 [ #  # ][ #  # ]:          0 :                 throw UnknownPropertyException( *pString, static_cast< XPropertySet* >( this ) );
     300                 :            : 
     301 [ #  # ][ #  # ]:          0 :             if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours !
     302 [ #  # ][ #  # ]:          0 :                 _getSingleValue( *((*aIter).second->mpInfo), *pAny );
     303                 :            :             else
     304                 :            :             {
     305 [ #  # ][ #  # ]:          0 :                 SlaveData * pSlave = maSlaveMap [ (*aIter).second->mnMapId ];
     306         [ #  # ]:          0 :                 if (!pSlave->IsInit())
     307                 :            :                 {
     308                 :            :                     // acquire mutex in c-tor and releases it in the d-tor (exception safe!).
     309         [ #  # ]:          0 :                     if (pSlave->mpSlave->mpMutex)
     310 [ #  # ][ #  # ]:          0 :                         aOGuardArray[i].reset( new osl::SolarGuard(pSlave->mpSlave->mpMutex) );
                 [ #  # ]
     311                 :            : 
     312         [ #  # ]:          0 :                     pSlave->mpSlave->_preGetValues();
     313                 :          0 :                     pSlave->SetInit ( sal_True );
     314                 :            :                 }
     315 [ #  # ][ #  # ]:          0 :                 pSlave->mpSlave->_getSingleValue( *((*aIter).second->mpInfo), *pAny );
     316                 :            :             }
     317                 :            :         }
     318                 :            : 
     319         [ #  # ]:          0 :         _postSetValues();
     320                 :          0 :         SlaveMap::const_iterator aSlaveIter = maSlaveMap.begin(), aSlaveEnd = maSlaveMap.end();
     321         [ #  # ]:          0 :         while (aSlaveIter != aSlaveEnd)
     322                 :            :         {
     323         [ #  # ]:          0 :             if ( (*aSlaveIter).second->IsInit())
     324                 :            :             {
     325         [ #  # ]:          0 :                 (*aSlaveIter).second->mpSlave->_postSetValues();
     326                 :          0 :                 (*aSlaveIter).second->SetInit ( sal_False );
     327                 :            :             }
     328                 :          0 :             ++aSlaveIter;
     329         [ #  # ]:          0 :         }
     330                 :            :     }
     331         [ #  # ]:          0 :     return aValues;
     332                 :            : }
     333                 :            : 
     334                 :          0 : void SAL_CALL MasterPropertySet::addPropertiesChangeListener( const Sequence< ::rtl::OUString >&, const Reference< XPropertiesChangeListener >& )
     335                 :            :     throw(RuntimeException)
     336                 :            : {
     337                 :            :     // todo
     338                 :          0 : }
     339                 :            : 
     340                 :          0 : void SAL_CALL MasterPropertySet::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& )
     341                 :            :     throw(RuntimeException)
     342                 :            : {
     343                 :            :     // todo
     344                 :          0 : }
     345                 :            : 
     346                 :          0 : void SAL_CALL MasterPropertySet::firePropertiesChangeEvent( const Sequence< ::rtl::OUString >&, const Reference< XPropertiesChangeListener >& )
     347                 :            :     throw(RuntimeException)
     348                 :            : {
     349                 :            :     // todo
     350                 :          0 : }
     351                 :            : 
     352                 :            : // XPropertyState
     353                 :          0 : PropertyState SAL_CALL MasterPropertySet::getPropertyState( const ::rtl::OUString& PropertyName )
     354                 :            :     throw(UnknownPropertyException, RuntimeException)
     355                 :            : {
     356         [ #  # ]:          0 :     PropertyDataHash::const_iterator aIter =  mpInfo->maMap.find( PropertyName );
     357 [ #  # ][ #  # ]:          0 :     if( aIter == mpInfo->maMap.end())
     358 [ #  # ][ #  # ]:          0 :         throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) );
     359                 :            : 
     360                 :            :     PropertyState aState;
     361                 :            : 
     362 [ #  # ][ #  # ]:          0 :     if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours !
     363                 :            :     {
     364         [ #  # ]:          0 :         _preGetPropertyState();
     365 [ #  # ][ #  # ]:          0 :         _getPropertyState( *((*aIter).second->mpInfo), aState );
     366         [ #  # ]:          0 :         _postGetPropertyState();
     367                 :            :     }
     368                 :            :     else
     369                 :            :     {
     370 [ #  # ][ #  # ]:          0 :         ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mpSlave;
     371                 :            : 
     372                 :            :         // acquire mutex in c-tor and releases it in the d-tor (exception safe!).
     373                 :          0 :         boost::scoped_ptr< osl::SolarGuard > pMutexGuard;
     374         [ #  # ]:          0 :         if (pSlave->mpMutex)
     375 [ #  # ][ #  # ]:          0 :             pMutexGuard.reset( new osl::SolarGuard(pSlave->mpMutex) );
                 [ #  # ]
     376                 :            : 
     377         [ #  # ]:          0 :         pSlave->_preGetPropertyState();
     378 [ #  # ][ #  # ]:          0 :         pSlave->_getPropertyState( *((*aIter).second->mpInfo), aState );
     379 [ #  # ][ #  # ]:          0 :         pSlave->_postGetPropertyState();
     380                 :            :     }
     381                 :            : 
     382                 :          0 :     return aState;
     383                 :            : }
     384                 :            : 
     385                 :          0 : Sequence< PropertyState > SAL_CALL MasterPropertySet::getPropertyStates( const Sequence< ::rtl::OUString >& rPropertyNames )
     386                 :            :     throw(UnknownPropertyException, RuntimeException)
     387                 :            : {
     388                 :          0 :     const sal_Int32 nCount = rPropertyNames.getLength();
     389                 :            : 
     390                 :          0 :     Sequence< PropertyState > aStates( nCount );
     391         [ #  # ]:          0 :     if( nCount )
     392                 :            :     {
     393         [ #  # ]:          0 :         PropertyState * pState = aStates.getArray();
     394                 :          0 :         const OUString * pString = rPropertyNames.getConstArray();
     395         [ #  # ]:          0 :         PropertyDataHash::const_iterator aEnd = mpInfo->maMap.end(), aIter;
     396         [ #  # ]:          0 :         _preGetPropertyState();
     397                 :            : 
     398         [ #  # ]:          0 :         for ( sal_Int32 i = 0; i < nCount; ++i, ++pString, ++pState )
     399                 :            :         {
     400         [ #  # ]:          0 :             aIter = mpInfo->maMap.find ( *pString );
     401         [ #  # ]:          0 :             if ( aIter == aEnd )
     402 [ #  # ][ #  # ]:          0 :                 throw UnknownPropertyException( *pString, static_cast< XPropertySet* >( this ) );
     403                 :            : 
     404 [ #  # ][ #  # ]:          0 :             if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours !
     405 [ #  # ][ #  # ]:          0 :                 _getPropertyState( *((*aIter).second->mpInfo), *pState );
     406                 :            :             else
     407                 :            :             {
     408 [ #  # ][ #  # ]:          0 :                 SlaveData * pSlave = maSlaveMap [ (*aIter).second->mnMapId ];
     409         [ #  # ]:          0 :                 if (!pSlave->IsInit())
     410                 :            :                 {
     411         [ #  # ]:          0 :                     pSlave->mpSlave->_preGetPropertyState();
     412                 :          0 :                     pSlave->SetInit ( sal_True );
     413                 :            :                 }
     414 [ #  # ][ #  # ]:          0 :                 pSlave->mpSlave->_getPropertyState( *((*aIter).second->mpInfo), *pState );
     415                 :            :             }
     416                 :            :         }
     417         [ #  # ]:          0 :         _postGetPropertyState();
     418                 :          0 :         SlaveMap::const_iterator aSlaveIter = maSlaveMap.begin(), aSlaveEnd = maSlaveMap.end();
     419         [ #  # ]:          0 :         while (aSlaveIter != aSlaveEnd)
     420                 :            :         {
     421         [ #  # ]:          0 :             if ( (*aSlaveIter).second->IsInit())
     422                 :            :             {
     423         [ #  # ]:          0 :                 (*aSlaveIter).second->mpSlave->_postGetPropertyState();
     424                 :          0 :                 (*aSlaveIter).second->SetInit ( sal_False );
     425                 :            :             }
     426                 :          0 :             ++aSlaveIter;
     427                 :            :         }
     428                 :            :     }
     429                 :          0 :     return aStates;
     430                 :            : }
     431                 :            : 
     432                 :          0 : void SAL_CALL MasterPropertySet::setPropertyToDefault( const ::rtl::OUString& rPropertyName )
     433                 :            :     throw(UnknownPropertyException, RuntimeException)
     434                 :            : {
     435         [ #  # ]:          0 :     PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName );
     436                 :            : 
     437 [ #  # ][ #  # ]:          0 :     if( aIter == mpInfo->maMap.end())
     438 [ #  # ][ #  # ]:          0 :         throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) );
     439 [ #  # ][ #  # ]:          0 :     _setPropertyToDefault( *((*aIter).second->mpInfo) );
     440                 :          0 : }
     441                 :            : 
     442                 :          0 : Any SAL_CALL MasterPropertySet::getPropertyDefault( const ::rtl::OUString& rPropertyName )
     443                 :            :     throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
     444                 :            : {
     445         [ #  # ]:          0 :     PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName );
     446                 :            : 
     447 [ #  # ][ #  # ]:          0 :     if( aIter == mpInfo->maMap.end())
     448 [ #  # ][ #  # ]:          0 :         throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) );
     449 [ #  # ][ #  # ]:          0 :     return _getPropertyDefault( *((*aIter).second->mpInfo) );
     450                 :            : }
     451                 :            : 
     452                 :          0 : void MasterPropertySet::_preGetPropertyState ()
     453                 :            :     throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException )
     454                 :            : {
     455                 :            :     OSL_FAIL( "you have to implement this yourself!");
     456                 :          0 : }
     457                 :            : 
     458                 :          0 : void MasterPropertySet::_getPropertyState( const comphelper::PropertyInfo&, PropertyState& )
     459                 :            :     throw(UnknownPropertyException )
     460                 :            : {
     461                 :            :     OSL_FAIL( "you have to implement this yourself!");
     462                 :          0 : }
     463                 :            : 
     464                 :          0 : void MasterPropertySet::_postGetPropertyState ()
     465                 :            :     throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException )
     466                 :            : {
     467                 :            :     OSL_FAIL( "you have to implement this yourself!");
     468                 :          0 : }
     469                 :            : 
     470                 :          0 : void MasterPropertySet::_setPropertyToDefault( const comphelper::PropertyInfo& )
     471                 :            :     throw(UnknownPropertyException )
     472                 :            : {
     473                 :            :     OSL_FAIL( "you have to implement this yourself!");
     474                 :          0 : }
     475                 :            : 
     476                 :          0 : Any MasterPropertySet::_getPropertyDefault( const comphelper::PropertyInfo& )
     477                 :            :     throw(UnknownPropertyException, WrappedTargetException )
     478                 :            : {
     479                 :            :     OSL_FAIL( "you have to implement this yourself!");
     480                 :          0 :     Any aAny;
     481                 :          0 :     return aAny;
     482                 :            : }
     483                 :            : 
     484                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10