LCOV - code coverage report
Current view: top level - toolkit/source/controls - animatedimages.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 66 208 31.7 %
Date: 2015-06-13 12:38:46 Functions: 19 48 39.6 %
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 <toolkit/controls/animatedimages.hxx>
      22             : #include <toolkit/helper/property.hxx>
      23             : 
      24             : #include <com/sun/star/lang/DisposedException.hpp>
      25             : #include <com/sun/star/awt/VisualEffect.hpp>
      26             : #include <com/sun/star/awt/ImageScaleMode.hpp>
      27             : #include <com/sun/star/awt/XAnimation.hpp>
      28             : #include <com/sun/star/awt/XAnimatedImages.hpp>
      29             : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      30             : #include <com/sun/star/container/XContainerListener.hpp>
      31             : #include <com/sun/star/uno/XComponentContext.hpp>
      32             : #include <com/sun/star/util/XModifyListener.hpp>
      33             : 
      34             : #include <toolkit/controls/unocontrolbase.hxx>
      35             : #include <toolkit/controls/unocontrolmodel.hxx>
      36             : 
      37             : #include <cppuhelper/implbase1.hxx>
      38             : #include <cppuhelper/implbase2.hxx>
      39             : 
      40             : #include "helper/unopropertyarrayhelper.hxx"
      41             : 
      42             : using namespace css::awt;
      43             : using namespace css::container;
      44             : using namespace css::lang;
      45             : using namespace css::uno;
      46             : 
      47             : namespace {
      48             : 
      49             : typedef ::cppu::AggImplInheritanceHelper2   <   UnoControlBase
      50             :                                             ,   css::awt::XAnimation
      51             :                                             ,   css::container::XContainerListener
      52             :                                             >   AnimatedImagesControl_Base;
      53             : 
      54           2 : class AnimatedImagesControl : public AnimatedImagesControl_Base
      55             : {
      56             : public:
      57             :     AnimatedImagesControl();
      58             :     OUString GetComponentServiceName() SAL_OVERRIDE;
      59             : 
      60             :     // XAnimation
      61             :     virtual void SAL_CALL startAnimation(  ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      62             :     virtual void SAL_CALL stopAnimation(  ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      63             :     virtual sal_Bool SAL_CALL isAnimationRunning(  ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      64             : 
      65             :     // XServiceInfo
      66             :     OUString SAL_CALL getImplementationName(  ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      67             :     css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      68             : 
      69             :     // XControl
      70             :     sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& i_rModel ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      71             :     void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& i_toolkit, const css::uno::Reference< css::awt::XWindowPeer >& i_parentPeer ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      72             : 
      73             : 
      74             :     // XContainerListener
      75             :     virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      76             :     virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      77             :     virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      78             : 
      79             :     // XEventListener
      80             :     virtual void SAL_CALL disposing( const css::lang::EventObject& i_event ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      81             : };
      82             : 
      83           1 :     AnimatedImagesControl::AnimatedImagesControl()
      84           1 :         :AnimatedImagesControl_Base()
      85             :     {
      86           1 :     }
      87             : 
      88             : 
      89           0 :     OUString AnimatedImagesControl::GetComponentServiceName()
      90             :     {
      91           0 :         return OUString( "AnimatedImages" );
      92             :     }
      93             : 
      94             : 
      95           0 :     void SAL_CALL AnimatedImagesControl::startAnimation(  ) throw (RuntimeException, std::exception)
      96             :     {
      97           0 :         Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
      98           0 :         if ( xAnimation.is() )
      99           0 :             xAnimation->startAnimation();
     100           0 :     }
     101             : 
     102             : 
     103           0 :     void SAL_CALL AnimatedImagesControl::stopAnimation(  ) throw (RuntimeException, std::exception)
     104             :     {
     105           0 :         Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
     106           0 :         if ( xAnimation.is() )
     107           0 :             xAnimation->stopAnimation();
     108           0 :     }
     109             : 
     110             : 
     111           0 :     sal_Bool SAL_CALL AnimatedImagesControl::isAnimationRunning(  ) throw (RuntimeException, std::exception)
     112             :     {
     113           0 :         Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
     114           0 :         if ( xAnimation.is() )
     115           0 :             return xAnimation->isAnimationRunning();
     116           0 :         return sal_False;
     117             :     }
     118             : 
     119             : 
     120           1 :     OUString SAL_CALL AnimatedImagesControl::getImplementationName(  ) throw(RuntimeException, std::exception)
     121             :     {
     122           1 :         return OUString( "org.openoffice.comp.toolkit.AnimatedImagesControl" );
     123             :     }
     124             : 
     125             : 
     126           1 :     Sequence< OUString > SAL_CALL AnimatedImagesControl::getSupportedServiceNames() throw(RuntimeException, std::exception)
     127             :     {
     128           1 :         Sequence< OUString > aServices( AnimatedImagesControl_Base::getSupportedServiceNames() );
     129           1 :         aServices.realloc( aServices.getLength() + 1 );
     130           1 :         aServices[ aServices.getLength() - 1 ] = "com.sun.star.awt.AnimatedImagesControl";
     131           1 :         return aServices;
     132             :     }
     133             : 
     134             : 
     135             :     namespace
     136             :     {
     137           0 :         void lcl_updatePeer( Reference< XWindowPeer > const& i_peer, Reference< XControlModel > const& i_model )
     138             :         {
     139           0 :             const Reference< css::util::XModifyListener > xPeerModify( i_peer, UNO_QUERY );
     140           0 :             if ( xPeerModify.is() )
     141             :             {
     142           0 :                 EventObject aEvent;
     143           0 :                 aEvent.Source = i_model;
     144           0 :                 xPeerModify->modified( aEvent );
     145           0 :             }
     146           0 :         }
     147             :     }
     148             : 
     149             : 
     150           1 :     sal_Bool SAL_CALL AnimatedImagesControl::setModel( const Reference< XControlModel >& i_rModel ) throw ( RuntimeException, std::exception )
     151             :     {
     152           1 :         const Reference< XAnimatedImages > xOldContainer( getModel(), UNO_QUERY );
     153           2 :         const Reference< XAnimatedImages > xNewContainer( i_rModel, UNO_QUERY );
     154             : 
     155           1 :         if ( !AnimatedImagesControl_Base::setModel( i_rModel ) )
     156           1 :             return sal_False;
     157             : 
     158           0 :         if ( xOldContainer.is() )
     159           0 :             xOldContainer->removeContainerListener( this );
     160             : 
     161           0 :         if ( xNewContainer.is() )
     162           0 :             xNewContainer->addContainerListener( this );
     163             : 
     164           0 :         lcl_updatePeer( getPeer(), getModel() );
     165             : 
     166           1 :         return sal_True;
     167             :     }
     168             : 
     169             : 
     170           0 :     void SAL_CALL AnimatedImagesControl::createPeer( const Reference< XToolkit >& i_toolkit, const Reference< XWindowPeer >& i_parentPeer ) throw(RuntimeException, std::exception)
     171             :     {
     172           0 :         AnimatedImagesControl_Base::createPeer( i_toolkit, i_parentPeer );
     173             : 
     174           0 :         lcl_updatePeer( getPeer(), getModel() );
     175           0 :     }
     176             : 
     177             : 
     178           0 :     void SAL_CALL AnimatedImagesControl::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException, std::exception)
     179             :     {
     180           0 :         const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
     181           0 :         if ( xPeerListener.is() )
     182           0 :             xPeerListener->elementInserted( i_event );
     183           0 :     }
     184             : 
     185             : 
     186           0 :     void SAL_CALL AnimatedImagesControl::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException, std::exception)
     187             :     {
     188           0 :         const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
     189           0 :         if ( xPeerListener.is() )
     190           0 :             xPeerListener->elementRemoved( i_event );
     191           0 :     }
     192             : 
     193             : 
     194           0 :     void SAL_CALL AnimatedImagesControl::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException, std::exception)
     195             :     {
     196           0 :         const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
     197           0 :         if ( xPeerListener.is() )
     198           0 :             xPeerListener->elementReplaced( i_event );
     199           0 :     }
     200             : 
     201             : 
     202           0 :     void SAL_CALL AnimatedImagesControl::disposing( const EventObject& i_event ) throw (RuntimeException, std::exception)
     203             :     {
     204           0 :         UnoControlBase::disposing( i_event );
     205           0 :     }
     206             : 
     207             : }
     208             : 
     209             : namespace toolkit {
     210             : 
     211           4 :     struct AnimatedImagesControlModel_Data
     212             :     {
     213             :         ::std::vector< Sequence< OUString > >    aImageSets;
     214             :     };
     215             : 
     216             :     namespace
     217             :     {
     218           3 :         void lcl_checkIndex( const AnimatedImagesControlModel_Data& i_data, const sal_Int32 i_index, const Reference< XInterface >& i_context,
     219             :             const bool i_forInsert = false )
     220             :         {
     221           3 :             if ( ( i_index < 0 ) || ( size_t( i_index ) > i_data.aImageSets.size() + ( i_forInsert ? 1 : 0 ) ) )
     222           0 :                 throw IndexOutOfBoundsException( OUString(), i_context );
     223           3 :         }
     224             : 
     225           3 :         void lcl_notify( ::osl::ClearableMutexGuard& i_guard, ::cppu::OBroadcastHelper& i_broadcaseHelper,
     226             :             void ( SAL_CALL XContainerListener::*i_notificationMethod )( const ContainerEvent& ),
     227             :             const sal_Int32 i_accessor, const Sequence< OUString >& i_imageURLs, const Reference< XInterface >& i_context )
     228             :         {
     229           3 :             ::cppu::OInterfaceContainerHelper* pContainerListeners = i_broadcaseHelper.getContainer( cppu::UnoType<XContainerListener>::get() );
     230           3 :             if ( pContainerListeners == NULL )
     231           6 :                 return;
     232             : 
     233           0 :             ContainerEvent aEvent;
     234           0 :             aEvent.Source = i_context;
     235           0 :             aEvent.Accessor <<= i_accessor;
     236           0 :             aEvent.Element <<= i_imageURLs;
     237             : 
     238           0 :             i_guard.clear();
     239           0 :             pContainerListeners->notifyEach( i_notificationMethod, aEvent );
     240             :         }
     241             :     }
     242             : 
     243             : 
     244           2 :     AnimatedImagesControlModel::AnimatedImagesControlModel( Reference< com::sun::star::uno::XComponentContext > const & i_factory )
     245             :         :AnimatedImagesControlModel_Base( i_factory )
     246           2 :         ,m_xData( new AnimatedImagesControlModel_Data )
     247             :     {
     248           2 :         ImplRegisterProperty( BASEPROPERTY_AUTO_REPEAT );
     249           2 :         ImplRegisterProperty( BASEPROPERTY_BORDER );
     250           2 :         ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
     251           2 :         ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
     252           2 :         ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
     253           2 :         ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
     254           2 :         ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
     255           2 :         ImplRegisterProperty( BASEPROPERTY_HELPURL );
     256           2 :         ImplRegisterProperty( BASEPROPERTY_IMAGE_SCALE_MODE );
     257           2 :         ImplRegisterProperty( BASEPROPERTY_STEP_TIME );
     258           2 :     }
     259             : 
     260             : 
     261           0 :     AnimatedImagesControlModel::AnimatedImagesControlModel( const AnimatedImagesControlModel& i_copySource )
     262             :         :AnimatedImagesControlModel_Base( i_copySource )
     263           0 :         ,m_xData( new AnimatedImagesControlModel_Data( *i_copySource.m_xData ) )
     264             :     {
     265           0 :     }
     266             : 
     267             : 
     268           3 :     AnimatedImagesControlModel::~AnimatedImagesControlModel()
     269             :     {
     270           3 :     }
     271             : 
     272             : 
     273           0 :     UnoControlModel* AnimatedImagesControlModel::Clone() const
     274             :     {
     275           0 :         return new AnimatedImagesControlModel( *this );
     276             :     }
     277             : 
     278             : 
     279           0 :     Reference< css::beans::XPropertySetInfo > SAL_CALL AnimatedImagesControlModel::getPropertySetInfo(  ) throw(RuntimeException, std::exception)
     280             :     {
     281           0 :         static Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
     282           0 :         return xInfo;
     283             :     }
     284             : 
     285             : 
     286           0 :     OUString SAL_CALL AnimatedImagesControlModel::getServiceName() throw(RuntimeException, std::exception)
     287             :     {
     288           0 :         return OUString("com.sun.star.awt.AnimatedImagesControlModel");
     289             :     }
     290             : 
     291             : 
     292           1 :     OUString SAL_CALL AnimatedImagesControlModel::getImplementationName(  ) throw(RuntimeException, std::exception)
     293             :     {
     294           1 :         return OUString("org.openoffice.comp.toolkit.AnimatedImagesControlModel");
     295             :     }
     296             : 
     297             : 
     298           1 :     Sequence< OUString > SAL_CALL AnimatedImagesControlModel::getSupportedServiceNames() throw(RuntimeException, std::exception)
     299             :     {
     300           1 :         Sequence< OUString > aServiceNames(2);
     301           1 :         aServiceNames[0] = "com.sun.star.awt.AnimatedImagesControlModel";
     302           1 :         aServiceNames[1] = "com.sun.star.awt.UnoControlModel";
     303           1 :         return aServiceNames;
     304             :     }
     305             : 
     306             : 
     307           0 :     void SAL_CALL AnimatedImagesControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 i_handle, const Any& i_value ) throw (Exception, std::exception)
     308             :     {
     309           0 :         switch ( i_handle )
     310             :         {
     311             :         case BASEPROPERTY_IMAGE_SCALE_MODE:
     312             :         {
     313           0 :             sal_Int16 nImageScaleMode( ImageScaleMode::ANISOTROPIC );
     314           0 :             OSL_VERIFY( i_value >>= nImageScaleMode );  // convertFastPropertyValue ensures that this has the proper type
     315           0 :             if  (   ( nImageScaleMode != ImageScaleMode::NONE )
     316           0 :                 &&  ( nImageScaleMode != ImageScaleMode::ISOTROPIC )
     317           0 :                 &&  ( nImageScaleMode != ImageScaleMode::ANISOTROPIC )
     318             :                 )
     319           0 :                 throw IllegalArgumentException( OUString(), *this, 1 );
     320             :         }
     321           0 :         break;
     322             :         }
     323             : 
     324           0 :         AnimatedImagesControlModel_Base::setFastPropertyValue_NoBroadcast( i_handle, i_value );
     325           0 :     }
     326             : 
     327             : 
     328          20 :     Any AnimatedImagesControlModel::ImplGetDefaultValue( sal_uInt16 i_propertyId ) const
     329             :     {
     330          20 :         switch ( i_propertyId )
     331             :         {
     332             :         case BASEPROPERTY_DEFAULTCONTROL:
     333           2 :             return makeAny( OUString("com.sun.star.awt.AnimatedImagesControl") );
     334             : 
     335             :         case BASEPROPERTY_BORDER:
     336           2 :             return makeAny( css::awt::VisualEffect::NONE );
     337             : 
     338             :         case BASEPROPERTY_STEP_TIME:
     339           2 :             return makeAny( (sal_Int32) 100 );
     340             : 
     341             :         case BASEPROPERTY_AUTO_REPEAT:
     342           2 :             return makeAny( true );
     343             : 
     344             :         case BASEPROPERTY_IMAGE_SCALE_MODE:
     345           2 :             return makeAny( ImageScaleMode::NONE );
     346             : 
     347             :         default:
     348          10 :             return UnoControlModel::ImplGetDefaultValue( i_propertyId );
     349             :         }
     350             :     }
     351             : 
     352             : 
     353           0 :     ::cppu::IPropertyArrayHelper& SAL_CALL AnimatedImagesControlModel::getInfoHelper()
     354             :     {
     355             :         static UnoPropertyArrayHelper* pHelper = NULL;
     356           0 :         if ( !pHelper )
     357             :         {
     358           0 :             Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
     359           0 :             pHelper = new UnoPropertyArrayHelper( aIDs );
     360             :         }
     361           0 :         return *pHelper;
     362             :     }
     363             : 
     364             : 
     365           0 :     ::sal_Int32 SAL_CALL AnimatedImagesControlModel::getStepTime() throw (RuntimeException, std::exception)
     366             :     {
     367           0 :         sal_Int32 nStepTime( 100 );
     368           0 :         OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_STEP_TIME ) ) >>= nStepTime );
     369           0 :         return nStepTime;
     370             :     }
     371             : 
     372             : 
     373           0 :     void SAL_CALL AnimatedImagesControlModel::setStepTime( ::sal_Int32 i_stepTime ) throw (RuntimeException, std::exception)
     374             :     {
     375           0 :         setPropertyValue( GetPropertyName( BASEPROPERTY_STEP_TIME ), makeAny( i_stepTime ) );
     376           0 :     }
     377             : 
     378             : 
     379           0 :     sal_Bool SAL_CALL AnimatedImagesControlModel::getAutoRepeat() throw (RuntimeException, std::exception)
     380             :     {
     381           0 :         bool bAutoRepeat( true );
     382           0 :         OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_AUTO_REPEAT ) ) >>= bAutoRepeat );
     383           0 :         return bAutoRepeat;
     384             :     }
     385             : 
     386             : 
     387           0 :     void SAL_CALL AnimatedImagesControlModel::setAutoRepeat( sal_Bool i_autoRepeat ) throw (RuntimeException, std::exception)
     388             :     {
     389           0 :         setPropertyValue( GetPropertyName( BASEPROPERTY_AUTO_REPEAT ), makeAny( i_autoRepeat ) );
     390           0 :     }
     391             : 
     392             : 
     393           0 :     ::sal_Int16 SAL_CALL AnimatedImagesControlModel::getScaleMode() throw (RuntimeException, std::exception)
     394             :     {
     395           0 :         sal_Int16 nImageScaleMode( ImageScaleMode::ANISOTROPIC );
     396           0 :         OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ) ) >>= nImageScaleMode );
     397           0 :         return nImageScaleMode;
     398             :     }
     399             : 
     400             : 
     401           0 :     void SAL_CALL AnimatedImagesControlModel::setScaleMode( ::sal_Int16 i_scaleMode ) throw (IllegalArgumentException, RuntimeException, std::exception)
     402             :     {
     403           0 :         setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ), makeAny( i_scaleMode ) );
     404           0 :     }
     405             : 
     406             : 
     407           0 :     ::sal_Int32 SAL_CALL AnimatedImagesControlModel::getImageSetCount(  ) throw (RuntimeException, std::exception)
     408             :     {
     409           0 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     410           0 :         if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
     411           0 :             throw DisposedException();
     412             : 
     413           0 :         return m_xData->aImageSets.size();
     414             :     }
     415             : 
     416             : 
     417           0 :     Sequence< OUString > SAL_CALL AnimatedImagesControlModel::getImageSet( ::sal_Int32 i_index ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     418             :     {
     419           0 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     420           0 :         if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
     421           0 :             throw DisposedException();
     422             : 
     423           0 :         lcl_checkIndex( *m_xData, i_index, *this );
     424             : 
     425           0 :         return m_xData->aImageSets[ i_index ];
     426             :     }
     427             : 
     428             : 
     429           3 :     void SAL_CALL AnimatedImagesControlModel::insertImageSet( ::sal_Int32 i_index, const Sequence< OUString >& i_imageURLs ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     430             :     {
     431           3 :         ::osl::ClearableMutexGuard aGuard( GetMutex() );
     432             :         // sanity checks
     433           3 :         if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
     434           0 :             throw DisposedException();
     435             : 
     436           3 :         lcl_checkIndex( *m_xData, i_index, *this, true );
     437             : 
     438             :         // actaul insertion
     439           3 :         m_xData->aImageSets.insert( m_xData->aImageSets.begin() + i_index, i_imageURLs );
     440             : 
     441             :         // listener notification
     442           3 :         lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementInserted, i_index, i_imageURLs, *this );
     443           3 :     }
     444             : 
     445             : 
     446           0 :     void SAL_CALL AnimatedImagesControlModel::replaceImageSet( ::sal_Int32 i_index, const Sequence< OUString >& i_imageURLs ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     447             :     {
     448           0 :         ::osl::ClearableMutexGuard aGuard( GetMutex() );
     449             :         // sanity checks
     450           0 :         if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
     451           0 :             throw DisposedException();
     452             : 
     453           0 :         lcl_checkIndex( *m_xData, i_index, *this );
     454             : 
     455             :         // actaul insertion
     456           0 :         m_xData->aImageSets[ i_index ] = i_imageURLs;
     457             : 
     458             :         // listener notification
     459           0 :         lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementReplaced, i_index, i_imageURLs, *this );
     460           0 :     }
     461             : 
     462             : 
     463           0 :     void SAL_CALL AnimatedImagesControlModel::removeImageSet( ::sal_Int32 i_index ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     464             :     {
     465           0 :         ::osl::ClearableMutexGuard aGuard( GetMutex() );
     466             :         // sanity checks
     467           0 :         if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
     468           0 :             throw DisposedException();
     469             : 
     470           0 :         lcl_checkIndex( *m_xData, i_index, *this );
     471             : 
     472             :         // actual removal
     473           0 :         ::std::vector< Sequence< OUString > >::iterator removalPos = m_xData->aImageSets.begin() + i_index;
     474           0 :         Sequence< OUString > aRemovedElement( *removalPos );
     475           0 :         m_xData->aImageSets.erase( removalPos );
     476             : 
     477             :         // listener notification
     478           0 :         lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementRemoved, i_index, aRemovedElement, *this );
     479           0 :     }
     480             : 
     481             : 
     482           0 :     void SAL_CALL AnimatedImagesControlModel::addContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException, std::exception)
     483             :     {
     484           0 :         BrdcstHelper.addListener( cppu::UnoType<XContainerListener>::get(), i_listener );
     485           0 :     }
     486             : 
     487             : 
     488           0 :     void SAL_CALL AnimatedImagesControlModel::removeContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException, std::exception)
     489             :     {
     490           0 :         BrdcstHelper.removeListener( cppu::UnoType<XContainerListener>::get(), i_listener );
     491           0 :     }
     492             : 
     493             : }
     494             : 
     495             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     496           1 : org_openoffice_comp_toolkit_AnimatedImagesControl_get_implementation(
     497             :     css::uno::XComponentContext *,
     498             :     css::uno::Sequence<css::uno::Any> const &)
     499             : {
     500           1 :     return cppu::acquire(new AnimatedImagesControl());
     501             : }
     502             : 
     503             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     504           1 : org_openoffice_comp_toolkit_AnimatedImagesControlModel_get_implementation(
     505             :     css::uno::XComponentContext *context,
     506             :     css::uno::Sequence<css::uno::Any> const &)
     507             : {
     508           1 :     return cppu::acquire(new toolkit::AnimatedImagesControlModel(context));
     509             : }
     510             : 
     511             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11