1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 //......................................................................................................................
33 //......................................................................................................................
35 using ::com::sun::star::uno::Reference
;
36 using ::com::sun::star::uno::XInterface
;
37 using ::com::sun::star::uno::UNO_QUERY
;
38 using ::com::sun::star::uno::UNO_QUERY_THROW
;
39 using ::com::sun::star::uno::UNO_SET_THROW
;
40 using ::com::sun::star::uno::Exception
;
41 using ::com::sun::star::uno::RuntimeException
;
42 using ::com::sun::star::uno::Any
;
43 using ::com::sun::star::uno::makeAny
;
44 using ::com::sun::star::uno::Sequence
;
45 using ::com::sun::star::uno::Type
;
46 using ::com::sun::star::beans::XPropertySetInfo
;
47 using ::com::sun::star::uno::XComponentContext
;
49 //==================================================================================================================
50 //= SpinningProgressControlModel
51 //==================================================================================================================
52 //------------------------------------------------------------------------------------------------------------------
53 SpinningProgressControlModel::SpinningProgressControlModel( Reference
< XComponentContext
> const & i_factory
)
54 :SpinningProgressControlModel_Base( i_factory
)
57 osl_atomic_increment( &m_refCount
);
61 Throbber::ImageSet aImageSets
[] =
63 Throbber::IMAGES_16_PX
, Throbber::IMAGES_32_PX
, Throbber::IMAGES_64_PX
65 for ( size_t i
=0; i
< sizeof( aImageSets
) / sizeof( aImageSets
[0] ); ++i
)
67 const ::std::vector
< OUString
> aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets
[i
] ) );
68 const Sequence
< OUString
> aImageURLs( &aDefaultURLs
[0], aDefaultURLs
.size() );
69 insertImageSet( i
, aImageURLs
);
72 catch( const Exception
& )
74 DBG_UNHANDLED_EXCEPTION();
77 osl_atomic_decrement( &m_refCount
);
80 //------------------------------------------------------------------------------------------------------------------
81 SpinningProgressControlModel::SpinningProgressControlModel( const SpinningProgressControlModel
& i_copySource
)
82 :SpinningProgressControlModel_Base( i_copySource
)
86 //------------------------------------------------------------------------------------------------------------------
87 SpinningProgressControlModel::~SpinningProgressControlModel()
91 //------------------------------------------------------------------------------------------------------------------
92 UnoControlModel
* SpinningProgressControlModel::Clone() const
94 return new SpinningProgressControlModel( *this );
97 //------------------------------------------------------------------------------------------------------------------
98 Reference
< XPropertySetInfo
> SAL_CALL
SpinningProgressControlModel::getPropertySetInfo( ) throw(RuntimeException
)
100 static Reference
< XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
104 //------------------------------------------------------------------------------------------------------------------
105 OUString SAL_CALL
SpinningProgressControlModel::getServiceName() throw(RuntimeException
)
107 return OUString::createFromAscii( szServiceName_SpinningProgressControlModel
);
110 //------------------------------------------------------------------------------------------------------------------
111 OUString SAL_CALL
SpinningProgressControlModel::getImplementationName( ) throw(RuntimeException
)
113 return OUString("org.openoffice.comp.toolkit.SpinningProgressControlModel");
116 //------------------------------------------------------------------------------------------------------------------
117 Sequence
< OUString
> SAL_CALL
SpinningProgressControlModel::getSupportedServiceNames() throw(RuntimeException
)
119 Sequence
< OUString
> aServiceNames(3);
120 aServiceNames
[0] = OUString::createFromAscii( szServiceName_SpinningProgressControlModel
);
121 aServiceNames
[1] = OUString::createFromAscii( szServiceName_AnimatedImagesControlModel
);
122 aServiceNames
[2] = "com.sun.star.awt.UnoControlModel";
123 return aServiceNames
;
126 //......................................................................................................................
127 } // namespace toolkit
128 //......................................................................................................................
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */