LCOV - code coverage report
Current view: top level - svx/source/table - propertyset.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 48 82 58.5 %
Date: 2015-06-13 12:38:46 Functions: 13 24 54.2 %
Legend: Lines: hit not hit

          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 "propertyset.hxx"
      22             : 
      23             : using namespace ::com::sun::star::uno;
      24             : using namespace ::com::sun::star::beans;
      25             : using namespace ::com::sun::star::lang;
      26             : 
      27             : namespace sdr { namespace table {
      28             : 
      29          10 : FastPropertySetInfo::FastPropertySetInfo( const PropertyVector& rProps )
      30             : {
      31          10 :     addProperties( rProps );
      32          10 : }
      33             : 
      34             : 
      35             : 
      36          16 : FastPropertySetInfo::~FastPropertySetInfo()
      37             : {
      38          16 : }
      39             : 
      40             : 
      41             : 
      42          10 : void FastPropertySetInfo::addProperties( const PropertyVector& rProps )
      43             : {
      44          10 :     sal_uInt32 nIndex = maProperties.size();
      45          10 :     sal_uInt32 nCount = rProps.size();
      46          10 :     maProperties.resize( nIndex + nCount );
      47          10 :     PropertyVector::const_iterator aIter( rProps.begin() );
      48          80 :     while( nCount-- )
      49             :     {
      50          60 :         const Property& rProperty = (*aIter++);
      51          60 :         maProperties[nIndex] = rProperty;
      52          60 :         maMap[ rProperty.Name ] = nIndex++;
      53             :     }
      54          10 : }
      55             : 
      56             : 
      57             : 
      58        5385 : const Property& FastPropertySetInfo::getProperty( const OUString& aName ) throw (UnknownPropertyException )
      59             : {
      60        5385 :     PropertyMap::iterator aIter( maMap.find( aName ) );
      61        5385 :     if( aIter == maMap.end() )
      62           0 :         throw UnknownPropertyException();
      63        5385 :     return maProperties[(*aIter).second];
      64             : }
      65             : 
      66             : 
      67             : 
      68          94 : const Property* FastPropertySetInfo::hasProperty( const OUString& aName )
      69             : {
      70          94 :     PropertyMap::iterator aIter( maMap.find( aName ) );
      71          94 :     if( aIter == maMap.end() )
      72           0 :         return 0;
      73             :     else
      74          94 :         return &maProperties[(*aIter).second];
      75             : }
      76             : 
      77             : 
      78             : // XPropertySetInfo
      79             : 
      80             : 
      81           0 : Sequence< Property > SAL_CALL FastPropertySetInfo::getProperties() throw (RuntimeException, std::exception)
      82             : {
      83           0 :     return Sequence< Property >( &maProperties[0], maProperties.size() );
      84             : }
      85             : 
      86             : 
      87             : 
      88           0 : Property SAL_CALL FastPropertySetInfo::getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException, std::exception)
      89             : {
      90           0 :     return getProperty( aName );
      91             : }
      92             : 
      93             : 
      94             : 
      95          47 : sal_Bool SAL_CALL FastPropertySetInfo::hasPropertyByName( const OUString& aName ) throw (RuntimeException, std::exception)
      96             : {
      97          47 :     return hasProperty( aName ) != 0 ? sal_True : sal_False;
      98             : }
      99             : 
     100         353 : FastPropertySet::FastPropertySet( const rtl::Reference< FastPropertySetInfo >& xInfo )
     101         353 : : mxInfo( xInfo )
     102             : {
     103         353 : }
     104             : 
     105             : 
     106             : 
     107         346 : FastPropertySet::~FastPropertySet()
     108             : {
     109         346 : }
     110             : 
     111             : 
     112             : // XPropertySet
     113             : 
     114             : 
     115          37 : Reference< XPropertySetInfo > SAL_CALL FastPropertySet::getPropertySetInfo(  ) throw (RuntimeException, std::exception)
     116             : {
     117          37 :     return Reference< XPropertySetInfo >( mxInfo.get() );
     118             : }
     119             : 
     120             : 
     121             : 
     122         812 : void SAL_CALL FastPropertySet::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception)
     123             : {
     124         812 :     setFastPropertyValue( mxInfo->getProperty( aPropertyName ).Handle, aValue );
     125         812 : }
     126             : 
     127             : 
     128             : 
     129        4573 : Any SAL_CALL FastPropertySet::getPropertyValue( const OUString& aPropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
     130             : {
     131        4573 :     return getFastPropertyValue( mxInfo->getProperty( aPropertyName ).Handle );
     132             : }
     133             : 
     134             : 
     135             : 
     136           0 : void SAL_CALL FastPropertySet::addPropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
     137             : {
     138           0 : }
     139             : 
     140             : 
     141             : 
     142           0 : void SAL_CALL FastPropertySet::removePropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
     143             : {
     144           0 : }
     145             : 
     146             : 
     147             : 
     148           0 : void SAL_CALL FastPropertySet::addVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
     149             : {
     150           0 : }
     151             : 
     152             : 
     153             : 
     154           0 : void SAL_CALL FastPropertySet::removeVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
     155             : {
     156           0 : }
     157             : 
     158             : 
     159             : // XMultiPropertySet
     160             : 
     161             : 
     162          37 : void SAL_CALL FastPropertySet::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception)
     163             : {
     164          37 :     const OUString* pPropertyNames = aPropertyNames.getConstArray();
     165          37 :     const Any* pValues = aValues.getConstArray();
     166          37 :     sal_Int32 nCount = aPropertyNames.getLength();
     167          37 :     if( nCount != aValues.getLength() )
     168           0 :         throw IllegalArgumentException();
     169             : 
     170         121 :     while( nCount-- )
     171             :     {
     172          47 :         const Property* pProperty = mxInfo->hasProperty( *pPropertyNames++ );
     173          47 :         if( pProperty ) try
     174             :         {
     175          47 :             setFastPropertyValue( pProperty->Handle, *pValues );
     176             :         }
     177           0 :         catch( UnknownPropertyException& )
     178             :         {
     179             :         }
     180          47 :         pValues++;
     181             :     }
     182          37 : }
     183             : 
     184             : 
     185             : 
     186           0 : Sequence< Any > SAL_CALL FastPropertySet::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw (RuntimeException, std::exception)
     187             : {
     188           0 :     sal_Int32 nCount = aPropertyNames.getLength();
     189           0 :     Sequence< Any > aValues( nCount );
     190             : 
     191           0 :     const OUString* pPropertyNames = aPropertyNames.getConstArray();
     192           0 :     Any* pValues = aValues.getArray();
     193           0 :     while( nCount-- )
     194             :     {
     195           0 :         const Property* pProperty = mxInfo->hasProperty( *pPropertyNames++ );
     196           0 :         if( pProperty ) try
     197             :         {
     198           0 :             *pValues = getFastPropertyValue( pProperty->Handle );
     199             :         }
     200           0 :         catch( UnknownPropertyException& )
     201             :         {
     202             :         }
     203           0 :         pValues++;
     204             :     }
     205           0 :     return aValues;
     206             : }
     207             : 
     208             : 
     209             : 
     210           0 : void SAL_CALL FastPropertySet::addPropertiesChangeListener( const Sequence< OUString >&, const Reference< XPropertiesChangeListener >& ) throw (RuntimeException, std::exception)
     211             : {
     212           0 : }
     213             : 
     214             : 
     215             : 
     216           0 : void SAL_CALL FastPropertySet::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& ) throw (RuntimeException, std::exception)
     217             : {
     218           0 : }
     219             : 
     220             : 
     221             : 
     222           0 : void SAL_CALL FastPropertySet::firePropertiesChangeEvent( const Sequence< OUString >&, const Reference< XPropertiesChangeListener >& ) throw (RuntimeException, std::exception)
     223             : {
     224           0 : }
     225             : 
     226             : }}
     227             : 
     228             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11