LCOV - code coverage report
Current view: top level - libreoffice/toolkit/source/controls - tkthrobber.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 75 0.0 %
Date: 2012-12-27 Functions: 0 18 0.0 %
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             : #include "toolkit/controls/tkthrobber.hxx"
      21             : #include "toolkit/helper/property.hxx"
      22             : #include "toolkit/helper/unopropertyarrayhelper.hxx"
      23             : #include <cppuhelper/typeprovider.hxx>
      24             : 
      25             : //........................................................................
      26             : namespace toolkit
      27             : {
      28             : //........................................................................
      29             : 
      30             :     using namespace ::com::sun::star;
      31             : 
      32             :     //====================================================================
      33             :     //= UnoThrobberControlModel
      34             :     //====================================================================
      35             :     //--------------------------------------------------------------------
      36           0 :     UnoThrobberControlModel::UnoThrobberControlModel( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
      37           0 :         :UnoControlModel( i_factory )
      38             :     {
      39           0 :         ImplRegisterProperty( BASEPROPERTY_BORDER );
      40           0 :         ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
      41           0 :         ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
      42           0 :         ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
      43           0 :         ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
      44           0 :         ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
      45           0 :         ImplRegisterProperty( BASEPROPERTY_HELPURL );
      46           0 :     }
      47             : 
      48             :     //--------------------------------------------------------------------
      49           0 :     ::rtl::OUString UnoThrobberControlModel::getServiceName( ) throw ( uno::RuntimeException )
      50             :     {
      51           0 :         return ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
      52             :     }
      53             : 
      54             :     //--------------------------------------------------------------------
      55           0 :     uno::Any UnoThrobberControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
      56             :     {
      57           0 :         switch ( nPropId )
      58             :         {
      59             :         case BASEPROPERTY_DEFAULTCONTROL:
      60           0 :             return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl ) );
      61             :         case BASEPROPERTY_BORDER:
      62           0 :             return uno::makeAny( (sal_Int16) 0 );
      63             :         default:
      64           0 :             return UnoControlModel::ImplGetDefaultValue( nPropId );
      65             :         }
      66             :     }
      67             : 
      68             :     //--------------------------------------------------------------------
      69           0 :     ::cppu::IPropertyArrayHelper& UnoThrobberControlModel::getInfoHelper()
      70             :     {
      71             :         static UnoPropertyArrayHelper* pHelper = NULL;
      72           0 :         if ( !pHelper )
      73             :         {
      74           0 :             uno::Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
      75           0 :             pHelper = new UnoPropertyArrayHelper( aIDs );
      76             :         }
      77           0 :         return *pHelper;
      78             :     }
      79             : 
      80             :     //--------------------------------------------------------------------
      81           0 :     uno::Reference< beans::XPropertySetInfo > UnoThrobberControlModel::getPropertySetInfo()
      82             :         throw( uno::RuntimeException )
      83             :     {
      84           0 :         static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
      85           0 :         return xInfo;
      86             :     }
      87             : 
      88             :     //--------------------------------------------------------------------
      89           0 :     ::rtl::OUString SAL_CALL UnoThrobberControlModel::getImplementationName()
      90             :         throw( uno::RuntimeException )
      91             :     {
      92           0 :         return ::rtl::OUString( "com.sun.star.comp.toolkit.UnoThrobberControlModel" );
      93             :     }
      94             : 
      95             :     //--------------------------------------------------------------------
      96           0 :     uno::Sequence< ::rtl::OUString > SAL_CALL UnoThrobberControlModel::getSupportedServiceNames()
      97             :         throw( uno::RuntimeException )
      98             :     {
      99           0 :         uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
     100           0 :         aServices.realloc( aServices.getLength() + 2 );
     101           0 :         aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 2] =
     102           0 :             ::rtl::OUString::createFromAscii(szServiceName_UnoThrobberControlModel);
     103           0 :         aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 1] =
     104           0 :             ::rtl::OUString::createFromAscii(szServiceName2_UnoThrobberControlModel);
     105           0 :         return aServices;
     106             :     }
     107             : 
     108             :     //====================================================================
     109             :     //= UnoThrobberControl
     110             :     //====================================================================
     111             :     //--------------------------------------------------------------------
     112           0 :     UnoThrobberControl::UnoThrobberControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
     113           0 :         :UnoControlBase( i_factory )
     114             :     {
     115           0 :     }
     116             : 
     117             :     //--------------------------------------------------------------------
     118           0 :     ::rtl::OUString UnoThrobberControl::GetComponentServiceName()
     119             :     {
     120           0 :         return ::rtl::OUString("Throbber");
     121             :     }
     122             : 
     123             :     //--------------------------------------------------------------------
     124           0 :     uno::Any UnoThrobberControl::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException )
     125             :     {
     126           0 :         uno::Any aRet = UnoControlBase::queryAggregation( rType );
     127           0 :         if ( !aRet.hasValue() )
     128           0 :             aRet = UnoThrobberControl_Base::queryInterface( rType );
     129           0 :         return aRet;
     130             :     }
     131             : 
     132             :     //--------------------------------------------------------------------
     133           0 :     IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoThrobberControl, UnoControlBase, UnoThrobberControl_Base )
     134             : 
     135             :     //--------------------------------------------------------------------
     136           0 :     void UnoThrobberControl::dispose() throw( uno::RuntimeException )
     137             :     {
     138           0 :         ::osl::ClearableMutexGuard aGuard( GetMutex() );
     139             : 
     140           0 :         UnoControl::dispose();
     141           0 :     }
     142             : 
     143             :     //--------------------------------------------------------------------
     144           0 :     ::rtl::OUString SAL_CALL UnoThrobberControl::getImplementationName()
     145             :         throw( uno::RuntimeException )
     146             :     {
     147           0 :         return ::rtl::OUString( "com.sun.star.comp.toolkit.UnoThrobberControl" );
     148             :     }
     149             : 
     150             :     //--------------------------------------------------------------------
     151           0 :     uno::Sequence< ::rtl::OUString > SAL_CALL UnoThrobberControl::getSupportedServiceNames()
     152             :         throw( uno::RuntimeException )
     153             :     {
     154           0 :         uno::Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
     155           0 :         aServices.realloc( aServices.getLength() + 2 );
     156           0 :         aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 2] =
     157           0 :             ::rtl::OUString::createFromAscii(szServiceName_UnoThrobberControl);
     158           0 :         aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 1] =
     159           0 :             ::rtl::OUString::createFromAscii(szServiceName2_UnoThrobberControl);
     160           0 :         return aServices;
     161             :     }
     162             : 
     163             :     //--------------------------------------------------------------------
     164           0 :     void UnoThrobberControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit,
     165             :                                          const uno::Reference< awt::XWindowPeer >  & rParentPeer )
     166             :         throw( uno::RuntimeException )
     167             :     {
     168           0 :         UnoControl::createPeer( rxToolkit, rParentPeer );
     169           0 :     }
     170             : 
     171             :     //--------------------------------------------------------------------
     172           0 :     void SAL_CALL UnoThrobberControl::start() throw ( uno::RuntimeException )
     173             :     {
     174           0 :         ::osl::MutexGuard aGuard( GetMutex() );
     175             : 
     176           0 :         uno::Reference< XThrobber > xAnimation( getPeer(), uno::UNO_QUERY );
     177           0 :         if ( xAnimation.is() )
     178           0 :             xAnimation->start();
     179           0 :     }
     180             : 
     181             :     //--------------------------------------------------------------------
     182           0 :     void SAL_CALL UnoThrobberControl::stop() throw ( uno::RuntimeException )
     183             :     {
     184           0 :         ::osl::MutexGuard aGuard( GetMutex() );
     185             : 
     186           0 :         uno::Reference< XThrobber > xAnimation( getPeer(), uno::UNO_QUERY );
     187           0 :         if ( xAnimation.is() )
     188           0 :             xAnimation->stop();
     189           0 :     }
     190             : 
     191             : //........................................................................
     192             : }  // namespace toolkit
     193             : //........................................................................
     194             : 
     195             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10