LCOV - code coverage report
Current view: top level - framework/source/fwe/helper - propertysetcontainer.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 62 0.0 %
Date: 2012-08-25 Functions: 0 12 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 94 0.0 %

           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 <helper/propertysetcontainer.hxx>
      30                 :            : #include <threadhelp/resetableguard.hxx>
      31                 :            : 
      32                 :            : #include <vcl/svapp.hxx>
      33                 :            : 
      34                 :            : #define WRONG_TYPE_EXCEPTION    "Only XPropertSet allowed!"
      35                 :            : 
      36                 :            : using ::rtl::OUString;
      37                 :            : using namespace cppu;
      38                 :            : using namespace com::sun::star::uno;
      39                 :            : using namespace com::sun::star::container;
      40                 :            : using namespace com::sun::star::lang;
      41                 :            : using namespace com::sun::star::beans;
      42                 :            : 
      43                 :            : namespace framework
      44                 :            : {
      45                 :            : 
      46                 :          0 : PropertySetContainer::PropertySetContainer( const Reference< XMultiServiceFactory >& )
      47         [ #  # ]:          0 :         :   ThreadHelpBase( &Application::GetSolarMutex() )
      48 [ #  # ][ #  # ]:          0 :         ,   OWeakObject()
      49                 :            : 
      50                 :            : {
      51                 :          0 : }
      52                 :            : 
      53                 :            : 
      54 [ #  # ][ #  # ]:          0 : PropertySetContainer::~PropertySetContainer()
      55                 :            : {
      56         [ #  # ]:          0 : }
      57                 :            : 
      58                 :            : 
      59                 :            : // XInterface
      60                 :          0 : void SAL_CALL PropertySetContainer::acquire() throw ()
      61                 :            : {
      62                 :          0 :     OWeakObject::acquire();
      63                 :          0 : }
      64                 :            : 
      65                 :          0 : void SAL_CALL PropertySetContainer::release() throw ()
      66                 :            : {
      67                 :          0 :     OWeakObject::release();
      68                 :          0 : }
      69                 :            : 
      70                 :          0 : Any SAL_CALL PropertySetContainer::queryInterface( const Type& rType )
      71                 :            : throw ( RuntimeException )
      72                 :            : {
      73                 :            :     Any a = ::cppu::queryInterface(
      74                 :            :                 rType ,
      75                 :            :                 (static_cast< XIndexContainer* >(this)),
      76                 :            :                 (static_cast< XIndexReplace* >(this)),
      77                 :            :                 (static_cast< XIndexAccess* >(this)),
      78         [ #  # ]:          0 :                 (static_cast< XElementAccess* >(this)) );
      79                 :            : 
      80         [ #  # ]:          0 :     if( a.hasValue() )
      81                 :            :     {
      82                 :          0 :         return a;
      83                 :            :     }
      84                 :            : 
      85         [ #  # ]:          0 :     return OWeakObject::queryInterface( rType );
      86                 :            : }
      87                 :            : 
      88                 :            : // XIndexContainer
      89                 :          0 : void SAL_CALL PropertySetContainer::insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
      90                 :            :     throw ( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
      91                 :            : {
      92         [ #  # ]:          0 :     ResetableGuard aGuard( m_aLock );
      93                 :            : 
      94                 :          0 :     sal_Int32 nSize = m_aPropertySetVector.size();
      95                 :            : 
      96         [ #  # ]:          0 :     if ( nSize >= Index )
      97                 :            :     {
      98                 :          0 :         Reference< XPropertySet > aPropertySetElement;
      99                 :            : 
     100 [ #  # ][ #  # ]:          0 :         if ( Element >>= aPropertySetElement )
     101                 :            :         {
     102         [ #  # ]:          0 :             if ( nSize == Index )
     103         [ #  # ]:          0 :                 m_aPropertySetVector.push_back( aPropertySetElement );
     104                 :            :             else
     105                 :            :             {
     106                 :          0 :                 PropertySetVector::iterator aIter = m_aPropertySetVector.begin();
     107                 :          0 :                 aIter += Index;
     108         [ #  # ]:          0 :                 m_aPropertySetVector.insert( aIter, aPropertySetElement );
     109                 :            :             }
     110                 :            :         }
     111                 :            :         else
     112                 :            :         {
     113                 :            :             throw IllegalArgumentException(
     114                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM( WRONG_TYPE_EXCEPTION )),
     115 [ #  # ][ #  # ]:          0 :                 (OWeakObject *)this, 2 );
                 [ #  # ]
     116                 :          0 :         }
     117                 :            :     }
     118                 :            :     else
     119 [ #  # ][ #  # ]:          0 :         throw IndexOutOfBoundsException( OUString(), (OWeakObject *)this );
                 [ #  # ]
     120                 :          0 : }
     121                 :            : 
     122                 :          0 : void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 Index )
     123                 :            :     throw ( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
     124                 :            : {
     125         [ #  # ]:          0 :     ResetableGuard aGuard( m_aLock );
     126                 :            : 
     127         [ #  # ]:          0 :     if ( (sal_Int32)m_aPropertySetVector.size() > Index )
     128                 :            :     {
     129                 :          0 :         PropertySetVector::iterator aIter = m_aPropertySetVector.begin();
     130                 :          0 :         aIter += Index;
     131         [ #  # ]:          0 :         m_aPropertySetVector.erase( aIter );
     132                 :            :     }
     133                 :            :     else
     134 [ #  # ][ #  # ]:          0 :         throw IndexOutOfBoundsException( OUString(), (OWeakObject *)this );
                 [ #  # ]
     135                 :          0 : }
     136                 :            : 
     137                 :            : // XIndexReplace
     138                 :          0 : void SAL_CALL PropertySetContainer::replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
     139                 :            :     throw ( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
     140                 :            : {
     141         [ #  # ]:          0 :     if ( (sal_Int32)m_aPropertySetVector.size() > Index )
     142                 :            :     {
     143                 :          0 :         Reference< XPropertySet > aPropertySetElement;
     144                 :            : 
     145 [ #  # ][ #  # ]:          0 :         if ( Element >>= aPropertySetElement )
     146                 :            :         {
     147         [ #  # ]:          0 :             m_aPropertySetVector[ Index ] = aPropertySetElement;
     148                 :            :         }
     149                 :            :         else
     150                 :            :         {
     151                 :            :             throw IllegalArgumentException(
     152                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM( WRONG_TYPE_EXCEPTION )),
     153 [ #  # ][ #  # ]:          0 :                 (OWeakObject *)this, 2 );
                 [ #  # ]
     154                 :          0 :         }
     155                 :            :     }
     156                 :            :     else
     157 [ #  # ][ #  # ]:          0 :         throw IndexOutOfBoundsException( OUString(), (OWeakObject *)this );
     158                 :          0 : }
     159                 :            : 
     160                 :            : // XIndexAccess
     161                 :          0 : sal_Int32 SAL_CALL PropertySetContainer::getCount()
     162                 :            :     throw ( RuntimeException )
     163                 :            : {
     164         [ #  # ]:          0 :     ResetableGuard aGuard( m_aLock );
     165                 :            : 
     166         [ #  # ]:          0 :     return m_aPropertySetVector.size();
     167                 :            : }
     168                 :            : 
     169                 :          0 : Any SAL_CALL PropertySetContainer::getByIndex( sal_Int32 Index )
     170                 :            :     throw ( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
     171                 :            : {
     172         [ #  # ]:          0 :     ResetableGuard aGuard( m_aLock );
     173                 :            : 
     174         [ #  # ]:          0 :     if ( (sal_Int32)m_aPropertySetVector.size() > Index )
     175                 :            :     {
     176                 :          0 :         Any a;
     177                 :            : 
     178         [ #  # ]:          0 :         a <<= m_aPropertySetVector[ Index ];
     179                 :          0 :         return a;
     180                 :            :     }
     181                 :            :     else
     182 [ #  # ][ #  # ]:          0 :         throw IndexOutOfBoundsException( OUString(), (OWeakObject *)this );
                 [ #  # ]
     183                 :            : }
     184                 :            : 
     185                 :            : // XElementAccess
     186                 :          0 : sal_Bool SAL_CALL PropertySetContainer::hasElements()
     187                 :            :     throw (::com::sun::star::uno::RuntimeException)
     188                 :            : {
     189         [ #  # ]:          0 :     ResetableGuard aGuard( m_aLock );
     190                 :            : 
     191         [ #  # ]:          0 :     return !( m_aPropertySetVector.empty() );
     192                 :            : }
     193                 :            : 
     194                 :            : }
     195                 :            : 
     196                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10