LCOV - code coverage report
Current view: top level - framework/source/fwi/uielement - constitemcontainer.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 59 146 40.4 %
Date: 2012-08-25 Functions: 13 37 35.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 67 290 23.1 %

           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                 :            : #include <uielement/constitemcontainer.hxx>
      30                 :            : #include <uielement/rootitemcontainer.hxx>
      31                 :            : #include <uielement/itemcontainer.hxx>
      32                 :            : #include <threadhelp/resetableguard.hxx>
      33                 :            : 
      34                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      35                 :            : 
      36                 :            : #include <cppuhelper/implbase1.hxx>
      37                 :            : #include <comphelper/servicehelper.hxx>
      38                 :            : 
      39                 :            : using namespace cppu;
      40                 :            : using namespace com::sun::star::uno;
      41                 :            : using namespace com::sun::star::lang;
      42                 :            : using namespace com::sun::star::beans;
      43                 :            : using namespace com::sun::star::container;
      44                 :            : 
      45                 :            : const int PROPHANDLE_UINAME     = 1;
      46                 :            : const int PROPCOUNT             = 1;
      47                 :            : const char PROPNAME_UINAME[]    = "UIName";
      48                 :            : 
      49                 :            : namespace framework
      50                 :            : {
      51                 :            : 
      52                 :            : /**
      53                 :            :  * The class which implements the PropertySetInfo interface.
      54                 :            :  */
      55                 :            : extern "C"
      56                 :            : {
      57                 :          0 : static int SAL_CALL compare_OUString_Property_Impl( const void *arg1, const void *arg2 ) SAL_THROW(())
      58                 :            : {
      59                 :          0 :    return ((::rtl::OUString *)arg1)->compareTo( ((Property *)arg2)->Name );
      60                 :            : }
      61                 :            : }
      62                 :            : 
      63 [ #  # ][ #  # ]:          0 : class OPropertySetHelperInfo_Impl
      64                 :            :     : public WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo >
      65                 :            : {
      66                 :            :     Sequence < Property > aInfos;
      67                 :            : 
      68                 :            : public:
      69                 :            :     OPropertySetHelperInfo_Impl( IPropertyArrayHelper & rHelper_ ) SAL_THROW(());
      70                 :            : 
      71                 :            :     // XPropertySetInfo-Methoden
      72                 :            :     virtual Sequence< Property > SAL_CALL getProperties(void) throw(::com::sun::star::uno::RuntimeException);
      73                 :            :     virtual Property SAL_CALL getPropertyByName(const ::rtl::OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
      74                 :            :     virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& PropertyName) throw(::com::sun::star::uno::RuntimeException);
      75                 :            : };
      76                 :            : 
      77                 :            : 
      78                 :            : /**
      79                 :            :  * Create an object that implements XPropertySetInfo IPropertyArrayHelper.
      80                 :            :  */
      81                 :          0 : OPropertySetHelperInfo_Impl::OPropertySetHelperInfo_Impl(
      82                 :            :     IPropertyArrayHelper & rHelper_ )
      83                 :            :     SAL_THROW(())
      84         [ #  # ]:          0 :     :aInfos( rHelper_.getProperties() )
      85                 :            : {
      86                 :          0 : }
      87                 :            : 
      88                 :            : /**
      89                 :            :  * Return the sequence of properties, which are provided throug the constructor.
      90                 :            :  */
      91                 :          0 : Sequence< Property > OPropertySetHelperInfo_Impl::getProperties(void) throw(::com::sun::star::uno::RuntimeException)
      92                 :            : {
      93                 :          0 :     return aInfos;
      94                 :            : }
      95                 :            : 
      96                 :            : /**
      97                 :            :  * Return the sequence of properties, which are provided throug the constructor.
      98                 :            :  */
      99                 :          0 : Property OPropertySetHelperInfo_Impl::getPropertyByName( const ::rtl::OUString & PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
     100                 :            : {
     101                 :            :     Property * pR;
     102                 :          0 :     pR = (Property *)bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(),
     103                 :            :                               sizeof( Property ),
     104                 :          0 :                               compare_OUString_Property_Impl );
     105         [ #  # ]:          0 :     if( !pR ) {
     106         [ #  # ]:          0 :         throw UnknownPropertyException();
     107                 :            :     }
     108                 :            : 
     109                 :          0 :     return *pR;
     110                 :            : }
     111                 :            : 
     112                 :            : /**
     113                 :            :  * Return the sequence of properties, which are provided throug the constructor.
     114                 :            :  */
     115                 :          0 : sal_Bool OPropertySetHelperInfo_Impl::hasPropertyByName( const ::rtl::OUString & PropertyName ) throw(::com::sun::star::uno::RuntimeException)
     116                 :            : {
     117                 :            :     Property * pR;
     118                 :          0 :     pR = (Property *)bsearch( &PropertyName, aInfos.getConstArray(), aInfos.getLength(),
     119                 :            :                               sizeof( Property ),
     120                 :          0 :                               compare_OUString_Property_Impl );
     121                 :          0 :     return pR != NULL;
     122                 :            : }
     123                 :            : 
     124                 :            : //*****************************************************************************************************************
     125                 :            : //  XInterface, XTypeProvider
     126                 :            : //*****************************************************************************************************************
     127 [ +  + ][ +  - ]:      32634 : DEFINE_XINTERFACE_6     (   ConstItemContainer                                              ,
     128                 :            :                             OWeakObject                                                     ,
     129                 :            :                             DIRECT_INTERFACE( ::com::sun::star::lang::XTypeProvider         ),
     130                 :            :                             DIRECT_INTERFACE( ::com::sun::star::container::XElementAccess   ),
     131                 :            :                             DIRECT_INTERFACE( ::com::sun::star::container::XIndexAccess     ),
     132                 :            :                             DIRECT_INTERFACE( ::com::sun::star::beans::XFastPropertySet     ),
     133                 :            :                             DIRECT_INTERFACE( ::com::sun::star::beans::XPropertySet         ),
     134                 :            :                             DIRECT_INTERFACE( ::com::sun::star::lang::XUnoTunnel            )
     135                 :            :                         )
     136                 :            : 
     137 [ #  # ][ #  # ]:          0 : DEFINE_XTYPEPROVIDER_6  (   ConstItemContainer                          ,
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     138                 :            :                             ::com::sun::star::lang::XTypeProvider       ,
     139                 :            :                             ::com::sun::star::container::XIndexAccess   ,
     140                 :            :                             ::com::sun::star::container::XElementAccess ,
     141                 :            :                             ::com::sun::star::beans::XFastPropertySet   ,
     142                 :            :                             ::com::sun::star::beans::XPropertySet       ,
     143                 :            :                             ::com::sun::star::lang::XUnoTunnel
     144                 :            :                         )
     145                 :            : 
     146         [ #  # ]:          0 : ConstItemContainer::ConstItemContainer() : ::cppu::OWeakObject()
     147                 :            : {
     148                 :          0 : }
     149                 :            : 
     150         [ #  # ]:          0 : ConstItemContainer::ConstItemContainer( const ItemContainer& rItemContainer )
     151                 :            : {
     152         [ #  # ]:          0 :     ShareGuard aLock( rItemContainer.m_aShareMutex );
     153 [ #  # ][ #  # ]:          0 :     copyItemContainer( rItemContainer.m_aItemVector );
     154                 :          0 : }
     155                 :            : 
     156         [ +  - ]:        656 : ConstItemContainer::ConstItemContainer( const Reference< XIndexAccess >& rSourceContainer, sal_Bool bFastCopy )
     157                 :            : {
     158                 :            :     // We also have to copy the UIName property
     159                 :            :     try
     160                 :            :     {
     161         [ +  - ]:        656 :         Reference< XPropertySet > xPropSet( rSourceContainer, UNO_QUERY );
     162         [ +  + ]:        656 :         if ( xPropSet.is() )
     163                 :            :         {
     164 [ +  - ][ +  - ]:        420 :             xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))) >>= m_aUIName;
                 [ +  - ]
     165         [ #  # ]:        656 :         }
     166                 :            :     }
     167         [ #  # ]:          0 :     catch ( const Exception& )
     168                 :            :     {
     169                 :            :     }
     170                 :            : 
     171         [ +  - ]:        656 :     if ( rSourceContainer.is() )
     172                 :            :     {
     173                 :            :         try
     174                 :            :         {
     175 [ +  - ][ +  - ]:        656 :             sal_Int32 nCount = rSourceContainer->getCount();
     176         [ +  - ]:        656 :             m_aItemVector.reserve(nCount);
     177         [ +  + ]:        656 :             if ( bFastCopy )
     178                 :            :             {
     179         [ +  + ]:       9684 :                 for ( sal_Int32 i = 0; i < nCount; i++ )
     180                 :            :                 {
     181         [ +  - ]:       9272 :                     Sequence< PropertyValue > aPropSeq;
     182 [ +  - ][ +  - ]:       9272 :                     if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
         [ +  - ][ +  - ]
     183         [ +  - ]:       9272 :                         m_aItemVector.push_back( aPropSeq );
     184         [ +  - ]:       9272 :                 }
     185                 :            :             }
     186                 :            :             else
     187                 :            :             {
     188         [ +  + ]:       2438 :                 for ( sal_Int32 i = 0; i < nCount; i++ )
     189                 :            :                 {
     190         [ +  - ]:       2194 :                     Sequence< PropertyValue > aPropSeq;
     191 [ +  - ][ +  - ]:       2194 :                     if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
         [ +  - ][ +  - ]
     192                 :            :                     {
     193                 :       2194 :                         sal_Int32 nContainerIndex = -1;
     194                 :       2194 :                         Reference< XIndexAccess > xIndexAccess;
     195         [ +  + ]:       6274 :                         for ( sal_Int32 j = 0; j < aPropSeq.getLength(); j++ )
     196                 :            :                         {
     197 [ +  - ][ +  + ]:       5942 :                             if ( aPropSeq[j].Name == "ItemDescriptorContainer" )
     198                 :            :                             {
     199 [ +  - ][ +  - ]:       1862 :                                 aPropSeq[j].Value >>= xIndexAccess;
     200                 :       1862 :                                 nContainerIndex = j;
     201                 :       1862 :                                 break;
     202                 :            :                             }
     203                 :            :                         }
     204                 :            : 
     205 [ +  + ][ +  - ]:       2194 :                         if ( xIndexAccess.is() && nContainerIndex >= 0 )
                 [ +  + ]
     206 [ +  - ][ +  - ]:        236 :                             aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess );
                 [ +  - ]
     207                 :            : 
     208         [ +  - ]:       2194 :                         m_aItemVector.push_back( aPropSeq );
     209                 :            :                     }
     210   [ +  -  #  # ]:       2194 :                 }
     211                 :            :             }
     212                 :            :         }
     213         [ #  # ]:          0 :         catch ( const IndexOutOfBoundsException& )
     214                 :            :         {
     215                 :            :         }
     216                 :            :     }
     217                 :        656 : }
     218                 :            : 
     219         [ +  - ]:        656 : ConstItemContainer::~ConstItemContainer()
     220                 :            : {
     221         [ -  + ]:       1312 : }
     222                 :            : 
     223                 :            : // private
     224                 :          0 : void ConstItemContainer::copyItemContainer( const std::vector< Sequence< PropertyValue > >& rSourceVector )
     225                 :            : {
     226                 :          0 :     const sal_uInt32 nCount = rSourceVector.size();
     227         [ #  # ]:          0 :     for ( sal_uInt32 i = 0; i < nCount; i++ )
     228                 :            :     {
     229                 :          0 :         sal_Int32 nContainerIndex = -1;
     230         [ #  # ]:          0 :         Sequence< PropertyValue > aPropSeq( rSourceVector[i] );
     231                 :          0 :         Reference< XIndexAccess > xIndexAccess;
     232         [ #  # ]:          0 :         for ( sal_Int32 j = 0; j < aPropSeq.getLength(); j++ )
     233                 :            :         {
     234 [ #  # ][ #  # ]:          0 :             if ( aPropSeq[j].Name == "ItemDescriptorContainer" )
     235                 :            :             {
     236 [ #  # ][ #  # ]:          0 :                 aPropSeq[j].Value >>= xIndexAccess;
     237                 :          0 :                 nContainerIndex = j;
     238                 :          0 :                 break;
     239                 :            :             }
     240                 :            :         }
     241                 :            : 
     242 [ #  # ][ #  # ]:          0 :         if ( xIndexAccess.is() && nContainerIndex >= 0 )
                 [ #  # ]
     243 [ #  # ][ #  # ]:          0 :             aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess );
                 [ #  # ]
     244                 :            : 
     245         [ #  # ]:          0 :         m_aItemVector.push_back( aPropSeq );
     246         [ #  # ]:          0 :     }
     247                 :          0 : }
     248                 :            : 
     249                 :        236 : Reference< XIndexAccess > ConstItemContainer::deepCopyContainer( const Reference< XIndexAccess >& rSubContainer )
     250                 :            : {
     251                 :        236 :     Reference< XIndexAccess > xReturn;
     252         [ +  - ]:        236 :     if ( rSubContainer.is() )
     253                 :            :     {
     254                 :        236 :         ItemContainer*      pSource = ItemContainer::GetImplementation( rSubContainer );
     255                 :        236 :         ConstItemContainer* pSubContainer( 0 );
     256         [ -  + ]:        236 :         if ( pSource )
     257         [ #  # ]:          0 :             pSubContainer = new ConstItemContainer( *pSource );
     258                 :            :         else
     259         [ +  - ]:        236 :             pSubContainer = new ConstItemContainer( rSubContainer );
     260 [ +  - ][ +  - ]:        236 :         xReturn = Reference< XIndexAccess >( static_cast< OWeakObject* >( pSubContainer ), UNO_QUERY );
                 [ +  - ]
     261                 :            :     }
     262                 :            : 
     263                 :        236 :     return xReturn;
     264                 :            : }
     265                 :            : 
     266                 :            : // XUnoTunnel
     267                 :         78 : sal_Int64 ConstItemContainer::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException)
     268                 :            : {
     269 [ +  - ][ +  - ]:         78 :     if( ( rIdentifier.getLength() == 16 ) && ( 0 == rtl_compareMemory( ConstItemContainer::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) )
                 [ +  - ]
     270                 :            :     {
     271                 :         78 :         return reinterpret_cast< sal_Int64 >( this );
     272                 :            :     }
     273                 :         78 :     return 0;
     274                 :            : }
     275                 :            : 
     276                 :            : namespace
     277                 :            : {
     278                 :            :     class theConstItemContainerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theConstItemContainerUnoTunnelId > {};
     279                 :            : }
     280                 :            : 
     281                 :        156 : const Sequence< sal_Int8 >& ConstItemContainer::GetUnoTunnelId() throw()
     282                 :            : {
     283                 :        156 :     return theConstItemContainerUnoTunnelId::get().getSeq();
     284                 :            : }
     285                 :            : 
     286                 :        382 : ConstItemContainer* ConstItemContainer::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw()
     287                 :            : {
     288         [ +  - ]:        382 :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( rxIFace, ::com::sun::star::uno::UNO_QUERY );
     289                 :        382 :     return xUT.is() ? reinterpret_cast< ConstItemContainer* >(sal::static_int_cast< sal_IntPtr >(
     290 [ +  - ][ +  - ]:        382 :                           xUT->getSomething( ConstItemContainer::GetUnoTunnelId() ))) : NULL;
                 [ +  + ]
     291                 :            : }
     292                 :            : 
     293                 :            : // XElementAccess
     294                 :          0 : sal_Bool SAL_CALL ConstItemContainer::hasElements()
     295                 :            : throw ( RuntimeException )
     296                 :            : {
     297                 :          0 :     return ( !m_aItemVector.empty() );
     298                 :            : }
     299                 :            : 
     300                 :            : // XIndexAccess
     301                 :     123349 : sal_Int32 SAL_CALL ConstItemContainer::getCount()
     302                 :            : throw ( RuntimeException )
     303                 :            : {
     304                 :     123349 :     return m_aItemVector.size();
     305                 :            : }
     306                 :            : 
     307                 :     118307 : Any SAL_CALL ConstItemContainer::getByIndex( sal_Int32 Index )
     308                 :            : throw ( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
     309                 :            : {
     310         [ +  - ]:     118307 :     if ( sal_Int32( m_aItemVector.size()) > Index )
     311                 :     118307 :         return makeAny( m_aItemVector[Index] );
     312                 :            :     else
     313 [ #  # ][ #  # ]:          0 :         throw IndexOutOfBoundsException( ::rtl::OUString(), (OWeakObject *)this );
     314                 :            : }
     315                 :            : 
     316                 :            : // XPropertySet
     317                 :          0 : Reference< XPropertySetInfo > SAL_CALL ConstItemContainer::getPropertySetInfo()
     318                 :            : throw (::com::sun::star::uno::RuntimeException)
     319                 :            : {
     320                 :            :     // Optimize this method !
     321                 :            :     // We initialize a static variable only one time. And we don't must use a mutex at every call!
     322                 :            :     // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
     323                 :            :     static Reference< XPropertySetInfo >* pInfo = NULL;
     324                 :            : 
     325         [ #  # ]:          0 :     if( pInfo == NULL )
     326                 :            :     {
     327                 :            :         // Ready for multithreading
     328 [ #  # ][ #  # ]:          0 :         osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
     329                 :            :         // Control this pointer again, another instance can be faster then these!
     330         [ #  # ]:          0 :         if( pInfo == NULL )
     331                 :            :         {
     332                 :            :             // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
     333                 :            :             // (Use method "getInfoHelper()".)
     334 [ #  # ][ #  # ]:          0 :             static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     335                 :          0 :             pInfo = &xInfo;
     336         [ #  # ]:          0 :         }
     337                 :            :     }
     338                 :            : 
     339                 :          0 :     return (*pInfo);
     340                 :            : }
     341                 :            : 
     342                 :          0 : void SAL_CALL ConstItemContainer::setPropertyValue( const ::rtl::OUString&, const Any& )
     343                 :            : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     344                 :            : {
     345                 :          0 : }
     346                 :            : 
     347                 :       2558 : Any SAL_CALL ConstItemContainer::getPropertyValue( const ::rtl::OUString& PropertyName )
     348                 :            : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     349                 :            : {
     350         [ +  - ]:       2558 :     if ( PropertyName == PROPNAME_UINAME )
     351                 :       2558 :         return makeAny( m_aUIName );
     352                 :            : 
     353         [ #  # ]:          0 :     throw UnknownPropertyException();
     354                 :            : }
     355                 :            : 
     356                 :          0 : void SAL_CALL ConstItemContainer::addPropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& )
     357                 :            : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     358                 :            : {
     359                 :          0 : }
     360                 :            : 
     361                 :          0 : void SAL_CALL ConstItemContainer::removePropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& )
     362                 :            : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     363                 :            : {
     364                 :            :     // Only read-only properties - do nothing
     365                 :          0 : }
     366                 :            : 
     367                 :          0 : void SAL_CALL ConstItemContainer::addVetoableChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& )
     368                 :            : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     369                 :            : {
     370                 :            :     // Only read-only properties - do nothing
     371                 :          0 : }
     372                 :            : 
     373                 :          0 : void SAL_CALL ConstItemContainer::removeVetoableChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& )
     374                 :            : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     375                 :            : {
     376                 :            :     // Only read-only properties - do nothing
     377                 :          0 : }
     378                 :            : 
     379                 :            : // XFastPropertySet
     380                 :          0 : void SAL_CALL ConstItemContainer::setFastPropertyValue( sal_Int32, const ::com::sun::star::uno::Any& )
     381                 :            : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     382                 :            : {
     383                 :          0 : }
     384                 :            : 
     385                 :          0 : Any SAL_CALL ConstItemContainer::getFastPropertyValue( sal_Int32 nHandle )
     386                 :            : throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     387                 :            : {
     388         [ #  # ]:          0 :     if ( nHandle == PROPHANDLE_UINAME )
     389                 :          0 :         return makeAny( m_aUIName );
     390                 :            : 
     391         [ #  # ]:          0 :     throw UnknownPropertyException();
     392                 :            : }
     393                 :            : 
     394                 :          0 : ::cppu::IPropertyArrayHelper& SAL_CALL ConstItemContainer::getInfoHelper()
     395                 :            : {
     396                 :            :     // Optimize this method !
     397                 :            :     // We initialize a static variable only one time. And we don't must use a mutex at every call!
     398                 :            :     // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL!
     399                 :            :     static ::cppu::OPropertyArrayHelper* pInfoHelper = NULL;
     400                 :            : 
     401         [ #  # ]:          0 :     if( pInfoHelper == NULL )
     402                 :            :     {
     403                 :            :         // Ready for multithreading
     404 [ #  # ][ #  # ]:          0 :         osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
     405                 :            : 
     406                 :            :         // Control this pointer again, another instance can be faster then these!
     407         [ #  # ]:          0 :         if( pInfoHelper == NULL )
     408                 :            :         {
     409                 :            :             // Define static member to give structure of properties to baseclass "OPropertySetHelper".
     410                 :            :             // "impl_getStaticPropertyDescriptor" is a non exported and static funtion, who will define a static propertytable.
     411                 :            :             // "sal_True" say: Table is sorted by name.
     412 [ #  # ][ #  # ]:          0 :             static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), sal_True );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     413                 :          0 :             pInfoHelper = &aInfoHelper;
     414         [ #  # ]:          0 :         }
     415                 :            :     }
     416                 :            : 
     417                 :          0 :     return(*pInfoHelper);
     418                 :            : }
     419                 :            : 
     420                 :          0 : const com::sun::star::uno::Sequence< com::sun::star::beans::Property > ConstItemContainer::impl_getStaticPropertyDescriptor()
     421                 :            : {
     422                 :            :     // Create a property array to initialize sequence!
     423                 :            :     // Table of all predefined properties of this class. Its used from OPropertySetHelper-class!
     424                 :            :     // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!!
     425                 :            :     // It's necessary for methods of OPropertySetHelper.
     426                 :            :     // ATTENTION:
     427                 :            :     //      YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!!
     428                 :            : 
     429                 :            :     const com::sun::star::beans::Property pProperties[] =
     430                 :            :     {
     431                 :            :         com::sun::star::beans::Property( rtl::OUString(PROPNAME_UINAME), PROPHANDLE_UINAME ,
     432         [ #  # ]:          0 :                                          ::getCppuType((const rtl::OUString*)NULL),
     433                 :            :                                          com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY  )
     434   [ #  #  #  # ]:          0 :     };
     435                 :            :     // Use it to initialize sequence!
     436         [ #  # ]:          0 :     const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, PROPCOUNT );
     437                 :            :     // Return "PropertyDescriptor"
     438 [ #  # ][ #  # ]:          0 :     return lPropertyDescriptor;
     439                 :            : }
     440                 :            : 
     441                 :          0 : Reference < XPropertySetInfo > ConstItemContainer::createPropertySetInfo(
     442                 :            :     IPropertyArrayHelper & rProperties ) SAL_THROW(())
     443                 :            : {
     444 [ #  # ][ #  # ]:          0 :     return static_cast< XPropertySetInfo * >( new OPropertySetHelperInfo_Impl( rProperties ) );
     445                 :            : }
     446                 :            : 
     447                 :            : } // namespace framework
     448                 :            : 
     449                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10