LCOV - code coverage report
Current view: top level - toolkit/source/controls - spinningprogress.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 24 35 68.6 %
Date: 2015-06-13 12:38:46 Functions: 8 12 66.7 %
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 <com/sun/star/uno/XComponentContext.hpp>
      21             : #include <rtl/ustrbuf.hxx>
      22             : #include <toolkit/controls/animatedimages.hxx>
      23             : #include <tools/diagnose_ex.h>
      24             : #include <vcl/throbber.hxx>
      25             : 
      26             : using namespace css;
      27             : using namespace css::uno;
      28             : 
      29             : namespace {
      30             : 
      31             : typedef toolkit::AnimatedImagesControlModel SpinningProgressControlModel_Base;
      32             : class SpinningProgressControlModel : public SpinningProgressControlModel_Base
      33             : {
      34             : public:
      35             :     explicit SpinningProgressControlModel( css::uno::Reference< css::uno::XComponentContext > const & i_factory );
      36             :     SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource );
      37             : 
      38             :     virtual UnoControlModel* Clone() const SAL_OVERRIDE;
      39             : 
      40             :     // XPropertySet
      41             :     css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      42             : 
      43             :     // XPersistObject
      44             :     OUString SAL_CALL getServiceName() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      45             : 
      46             :     // XServiceInfo
      47             :     OUString SAL_CALL getImplementationName(  ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      48             :     css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      49             : 
      50             : protected:
      51             :     virtual ~SpinningProgressControlModel();
      52             : };
      53             : 
      54           1 :     SpinningProgressControlModel::SpinningProgressControlModel( Reference< XComponentContext > const & i_factory )
      55           1 :         :SpinningProgressControlModel_Base( i_factory )
      56             :     {
      57             :         // default image sets
      58           1 :         osl_atomic_increment( &m_refCount );
      59             :         {
      60             :             try
      61             :             {
      62             :                 Throbber::ImageSet aImageSets[] =
      63             :                 {
      64             :                     Throbber::IMAGES_16_PX, Throbber::IMAGES_32_PX, Throbber::IMAGES_64_PX
      65           1 :                 };
      66           4 :                 for ( size_t i=0; i < sizeof( aImageSets ) / sizeof( aImageSets[0] ); ++i )
      67             :                 {
      68           3 :                     const ::std::vector< OUString > aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets[i] ) );
      69           6 :                     const Sequence< OUString > aImageURLs( &aDefaultURLs[0], aDefaultURLs.size() );
      70           3 :                     insertImageSet( i, aImageURLs );
      71           3 :                 }
      72             :             }
      73           0 :             catch( const Exception& )
      74             :             {
      75             :                 DBG_UNHANDLED_EXCEPTION();
      76             :             }
      77             :         }
      78           1 :         osl_atomic_decrement( &m_refCount );
      79           1 :     }
      80             : 
      81             : 
      82           0 :     SpinningProgressControlModel::SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource )
      83           0 :         :SpinningProgressControlModel_Base( i_copySource )
      84             :     {
      85           0 :     }
      86             : 
      87             : 
      88           2 :     SpinningProgressControlModel::~SpinningProgressControlModel()
      89             :     {
      90           2 :     }
      91             : 
      92             : 
      93           0 :     UnoControlModel* SpinningProgressControlModel::Clone() const
      94             :     {
      95           0 :         return new SpinningProgressControlModel( *this );
      96             :     }
      97             : 
      98             : 
      99           0 :     Reference< beans::XPropertySetInfo > SAL_CALL SpinningProgressControlModel::getPropertySetInfo(  ) throw(RuntimeException, std::exception)
     100             :     {
     101           0 :         static Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
     102           0 :         return xInfo;
     103             :     }
     104             : 
     105             : 
     106           0 :     OUString SAL_CALL SpinningProgressControlModel::getServiceName() throw(RuntimeException, std::exception)
     107             :     {
     108           0 :         return OUString("com.sun.star.awt.SpinningProgressControlModel");
     109             :     }
     110             : 
     111             : 
     112           1 :     OUString SAL_CALL SpinningProgressControlModel::getImplementationName(  ) throw(RuntimeException, std::exception)
     113             :     {
     114           1 :         return OUString("org.openoffice.comp.toolkit.SpinningProgressControlModel");
     115             :     }
     116             : 
     117             : 
     118           1 :     Sequence< OUString > SAL_CALL SpinningProgressControlModel::getSupportedServiceNames() throw(RuntimeException, std::exception)
     119             :     {
     120           1 :         Sequence< OUString > aServiceNames(3);
     121           1 :         aServiceNames[0] = "com.sun.star.awt.SpinningProgressControlModel";
     122           1 :         aServiceNames[1] = "com.sun.star.awt.AnimatedImagesControlModel";
     123           1 :         aServiceNames[2] = "com.sun.star.awt.UnoControlModel";
     124           1 :         return aServiceNames;
     125             :     }
     126             : 
     127             : }
     128             : 
     129             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     130           1 : org_openoffice_comp_toolkit_SpinningProgressControlModel_get_implementation(
     131             :     css::uno::XComponentContext *context,
     132             :     css::uno::Sequence<css::uno::Any> const &)
     133             : {
     134           1 :     return cppu::acquire(new SpinningProgressControlModel(context));
     135         798 : }
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11