1*b0724fc6SAndrew Rist /**************************************************************
2*b0724fc6SAndrew Rist  *
3*b0724fc6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b0724fc6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b0724fc6SAndrew Rist  * distributed with this work for additional information
6*b0724fc6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b0724fc6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b0724fc6SAndrew Rist  * "License"); you may not use this file except in compliance
9*b0724fc6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b0724fc6SAndrew Rist  *
11*b0724fc6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b0724fc6SAndrew Rist  *
13*b0724fc6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b0724fc6SAndrew Rist  * software distributed under the License is distributed on an
15*b0724fc6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b0724fc6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b0724fc6SAndrew Rist  * specific language governing permissions and limitations
18*b0724fc6SAndrew Rist  * under the License.
19*b0724fc6SAndrew Rist  *
20*b0724fc6SAndrew Rist  *************************************************************/
21*b0724fc6SAndrew Rist 
22*b0724fc6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "precompiled_toolkit.hxx"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "toolkit/controls/spinningprogress.hxx"
27cdf0e10cSrcweir #include "toolkit/helper/servicenames.hxx"
28cdf0e10cSrcweir #include "toolkit/helper/unopropertyarrayhelper.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir /** === begin UNO includes === **/
31cdf0e10cSrcweir /** === end UNO includes === **/
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
34cdf0e10cSrcweir #include <tools/diagnose_ex.h>
35cdf0e10cSrcweir #include <vcl/throbber.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //......................................................................................................................
38cdf0e10cSrcweir namespace toolkit
39cdf0e10cSrcweir {
40cdf0e10cSrcweir //......................................................................................................................
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 	/** === begin UNO using === **/
43cdf0e10cSrcweir 	using ::com::sun::star::uno::Reference;
44cdf0e10cSrcweir 	using ::com::sun::star::uno::XInterface;
45cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_QUERY;
46cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_QUERY_THROW;
47cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_SET_THROW;
48cdf0e10cSrcweir 	using ::com::sun::star::uno::Exception;
49cdf0e10cSrcweir 	using ::com::sun::star::uno::RuntimeException;
50cdf0e10cSrcweir 	using ::com::sun::star::uno::Any;
51cdf0e10cSrcweir 	using ::com::sun::star::uno::makeAny;
52cdf0e10cSrcweir 	using ::com::sun::star::uno::Sequence;
53cdf0e10cSrcweir 	using ::com::sun::star::uno::Type;
54cdf0e10cSrcweir     using ::com::sun::star::beans::XPropertySetInfo;
55cdf0e10cSrcweir     using ::com::sun::star::lang::XMultiServiceFactory;
56cdf0e10cSrcweir 	/** === end UNO using === **/
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	//==================================================================================================================
59cdf0e10cSrcweir 	//= SpinningProgressControlModel
60cdf0e10cSrcweir 	//==================================================================================================================
61cdf0e10cSrcweir 	//------------------------------------------------------------------------------------------------------------------
SpinningProgressControlModel(Reference<XMultiServiceFactory> const & i_factory)62cdf0e10cSrcweir     SpinningProgressControlModel::SpinningProgressControlModel( Reference< XMultiServiceFactory > const & i_factory )
63cdf0e10cSrcweir         :SpinningProgressControlModel_Base( i_factory )
64cdf0e10cSrcweir     {
65cdf0e10cSrcweir         // default image sets
66cdf0e10cSrcweir         osl_incrementInterlockedCount( &m_refCount );
67cdf0e10cSrcweir         {
68cdf0e10cSrcweir             try
69cdf0e10cSrcweir             {
70cdf0e10cSrcweir                 Throbber::ImageSet aImageSets[] =
71cdf0e10cSrcweir                 {
72cdf0e10cSrcweir                     Throbber::IMAGES_16_PX, Throbber::IMAGES_32_PX, Throbber::IMAGES_64_PX
73cdf0e10cSrcweir                 };
74cdf0e10cSrcweir                 for ( size_t i=0; i < sizeof( aImageSets ) / sizeof( aImageSets[0] ); ++i )
75cdf0e10cSrcweir                 {
76cdf0e10cSrcweir                     const ::std::vector< ::rtl::OUString > aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets[i] ) );
77cdf0e10cSrcweir                     const Sequence< ::rtl::OUString > aImageURLs( &aDefaultURLs[0], aDefaultURLs.size() );
78cdf0e10cSrcweir                     insertImageSet( i, aImageURLs );
79cdf0e10cSrcweir                 }
80cdf0e10cSrcweir             }
81cdf0e10cSrcweir             catch( const Exception& )
82cdf0e10cSrcweir             {
83cdf0e10cSrcweir             	DBG_UNHANDLED_EXCEPTION();
84cdf0e10cSrcweir             }
85cdf0e10cSrcweir         }
86cdf0e10cSrcweir         osl_decrementInterlockedCount( &m_refCount );
87cdf0e10cSrcweir     }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	//------------------------------------------------------------------------------------------------------------------
SpinningProgressControlModel(const SpinningProgressControlModel & i_copySource)90cdf0e10cSrcweir     SpinningProgressControlModel::SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource )
91cdf0e10cSrcweir         :SpinningProgressControlModel_Base( i_copySource )
92cdf0e10cSrcweir     {
93cdf0e10cSrcweir     }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
~SpinningProgressControlModel()96cdf0e10cSrcweir     SpinningProgressControlModel::~SpinningProgressControlModel()
97cdf0e10cSrcweir     {
98cdf0e10cSrcweir     }
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
Clone() const101cdf0e10cSrcweir     UnoControlModel* SpinningProgressControlModel::Clone() const
102cdf0e10cSrcweir     {
103cdf0e10cSrcweir         return new SpinningProgressControlModel( *this );
104cdf0e10cSrcweir     }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
getPropertySetInfo()107cdf0e10cSrcweir     Reference< XPropertySetInfo > SAL_CALL SpinningProgressControlModel::getPropertySetInfo(  ) throw(RuntimeException)
108cdf0e10cSrcweir     {
109cdf0e10cSrcweir         static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
110cdf0e10cSrcweir         return xInfo;
111cdf0e10cSrcweir     }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
getServiceName()114cdf0e10cSrcweir     ::rtl::OUString SAL_CALL SpinningProgressControlModel::getServiceName() throw(RuntimeException)
115cdf0e10cSrcweir     {
116cdf0e10cSrcweir         return ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
117cdf0e10cSrcweir     }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
getImplementationName()120cdf0e10cSrcweir     ::rtl::OUString SAL_CALL SpinningProgressControlModel::getImplementationName(  ) throw(RuntimeException)
121cdf0e10cSrcweir     {
122cdf0e10cSrcweir         return ::rtl::OUString::createFromAscii( "org.openoffice.comp.toolkit.SpinningProgressControlModel" );
123cdf0e10cSrcweir     }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
getSupportedServiceNames()126cdf0e10cSrcweir     Sequence< ::rtl::OUString > SAL_CALL SpinningProgressControlModel::getSupportedServiceNames() throw(RuntimeException)
127cdf0e10cSrcweir     {
128cdf0e10cSrcweir         Sequence< ::rtl::OUString > aServiceNames(3);
129cdf0e10cSrcweir         aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
130cdf0e10cSrcweir         aServiceNames[1] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
131cdf0e10cSrcweir         aServiceNames[2] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.UnoControlModel" );
132cdf0e10cSrcweir         return aServiceNames;
133cdf0e10cSrcweir     }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir //......................................................................................................................
136cdf0e10cSrcweir } // namespace toolkit
137cdf0e10cSrcweir //......................................................................................................................
138