Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / toolkit / source / controls / spinningprogress.cxx
blob2c4513dd286b38210028f58de58462750838c030
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "toolkit/controls/spinningprogress.hxx"
22 #include "toolkit/helper/servicenames.hxx"
23 #include "toolkit/helper/unopropertyarrayhelper.hxx"
26 #include <rtl/ustrbuf.hxx>
27 #include <tools/diagnose_ex.h>
28 #include <vcl/throbber.hxx>
30 //......................................................................................................................
31 namespace toolkit
33 //......................................................................................................................
35 /** === begin UNO using === **/
36 using ::com::sun::star::uno::Reference;
37 using ::com::sun::star::uno::XInterface;
38 using ::com::sun::star::uno::UNO_QUERY;
39 using ::com::sun::star::uno::UNO_QUERY_THROW;
40 using ::com::sun::star::uno::UNO_SET_THROW;
41 using ::com::sun::star::uno::Exception;
42 using ::com::sun::star::uno::RuntimeException;
43 using ::com::sun::star::uno::Any;
44 using ::com::sun::star::uno::makeAny;
45 using ::com::sun::star::uno::Sequence;
46 using ::com::sun::star::uno::Type;
47 using ::com::sun::star::beans::XPropertySetInfo;
48 using ::com::sun::star::lang::XMultiServiceFactory;
49 /** === end UNO using === **/
51 //==================================================================================================================
52 //= SpinningProgressControlModel
53 //==================================================================================================================
54 //------------------------------------------------------------------------------------------------------------------
55 SpinningProgressControlModel::SpinningProgressControlModel( Reference< XMultiServiceFactory > const & i_factory )
56 :SpinningProgressControlModel_Base( i_factory )
58 // default image sets
59 osl_atomic_increment( &m_refCount );
61 try
63 Throbber::ImageSet aImageSets[] =
65 Throbber::IMAGES_16_PX, Throbber::IMAGES_32_PX, Throbber::IMAGES_64_PX
67 for ( size_t i=0; i < sizeof( aImageSets ) / sizeof( aImageSets[0] ); ++i )
69 const ::std::vector< ::rtl::OUString > aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets[i] ) );
70 const Sequence< ::rtl::OUString > aImageURLs( &aDefaultURLs[0], aDefaultURLs.size() );
71 insertImageSet( i, aImageURLs );
74 catch( const Exception& )
76 DBG_UNHANDLED_EXCEPTION();
79 osl_atomic_decrement( &m_refCount );
82 //------------------------------------------------------------------------------------------------------------------
83 SpinningProgressControlModel::SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource )
84 :SpinningProgressControlModel_Base( i_copySource )
88 //------------------------------------------------------------------------------------------------------------------
89 SpinningProgressControlModel::~SpinningProgressControlModel()
93 //------------------------------------------------------------------------------------------------------------------
94 UnoControlModel* SpinningProgressControlModel::Clone() const
96 return new SpinningProgressControlModel( *this );
99 //------------------------------------------------------------------------------------------------------------------
100 Reference< XPropertySetInfo > SAL_CALL SpinningProgressControlModel::getPropertySetInfo( ) throw(RuntimeException)
102 static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
103 return xInfo;
106 //------------------------------------------------------------------------------------------------------------------
107 ::rtl::OUString SAL_CALL SpinningProgressControlModel::getServiceName() throw(RuntimeException)
109 return ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
112 //------------------------------------------------------------------------------------------------------------------
113 ::rtl::OUString SAL_CALL SpinningProgressControlModel::getImplementationName( ) throw(RuntimeException)
115 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.toolkit.SpinningProgressControlModel"));
118 //------------------------------------------------------------------------------------------------------------------
119 Sequence< ::rtl::OUString > SAL_CALL SpinningProgressControlModel::getSupportedServiceNames() throw(RuntimeException)
121 Sequence< ::rtl::OUString > aServiceNames(3);
122 aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
123 aServiceNames[1] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
124 aServiceNames[2] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlModel"));
125 return aServiceNames;
128 //......................................................................................................................
129 } // namespace toolkit
130 //......................................................................................................................
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */