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 .
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>
27 using namespace css::uno
;
31 typedef toolkit::AnimatedImagesControlModel SpinningProgressControlModel_Base
;
32 class SpinningProgressControlModel
: public SpinningProgressControlModel_Base
35 explicit SpinningProgressControlModel( css::uno::Reference
< css::uno::XComponentContext
> const & i_factory
);
36 SpinningProgressControlModel( const SpinningProgressControlModel
& i_copySource
);
38 virtual UnoControlModel
* Clone() const override
;
41 css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
44 OUString SAL_CALL
getServiceName() override
;
47 OUString SAL_CALL
getImplementationName( ) override
;
48 css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
51 virtual ~SpinningProgressControlModel() override
;
54 SpinningProgressControlModel::SpinningProgressControlModel( Reference
< XComponentContext
> const & i_factory
)
55 :SpinningProgressControlModel_Base( i_factory
)
58 osl_atomic_increment( &m_refCount
);
62 Throbber::ImageSet aImageSets
[] =
64 Throbber::ImageSet::N16px
, Throbber::ImageSet::N32px
, Throbber::ImageSet::N64px
66 for ( size_t i
=0; i
< SAL_N_ELEMENTS(aImageSets
); ++i
)
68 const ::std::vector
< OUString
> aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets
[i
] ) );
69 const Sequence
< OUString
> aImageURLs( &aDefaultURLs
[0], aDefaultURLs
.size() );
70 insertImageSet( i
, aImageURLs
);
73 catch( const Exception
& )
75 DBG_UNHANDLED_EXCEPTION();
78 osl_atomic_decrement( &m_refCount
);
82 SpinningProgressControlModel::SpinningProgressControlModel( const SpinningProgressControlModel
& i_copySource
)
83 :SpinningProgressControlModel_Base( i_copySource
)
88 SpinningProgressControlModel::~SpinningProgressControlModel()
93 UnoControlModel
* SpinningProgressControlModel::Clone() const
95 return new SpinningProgressControlModel( *this );
99 Reference
< beans::XPropertySetInfo
> SAL_CALL
SpinningProgressControlModel::getPropertySetInfo( )
101 static Reference
< beans::XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
106 OUString SAL_CALL
SpinningProgressControlModel::getServiceName()
108 return OUString("com.sun.star.awt.SpinningProgressControlModel");
112 OUString SAL_CALL
SpinningProgressControlModel::getImplementationName( )
114 return OUString("org.openoffice.comp.toolkit.SpinningProgressControlModel");
118 Sequence
< OUString
> SAL_CALL
SpinningProgressControlModel::getSupportedServiceNames()
120 Sequence
< OUString
> aServiceNames(3);
121 aServiceNames
[0] = "com.sun.star.awt.SpinningProgressControlModel";
122 aServiceNames
[1] = "com.sun.star.awt.AnimatedImagesControlModel";
123 aServiceNames
[2] = "com.sun.star.awt.UnoControlModel";
124 return aServiceNames
;
129 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
* SAL_CALL
130 org_openoffice_comp_toolkit_SpinningProgressControlModel_get_implementation(
131 css::uno::XComponentContext
*context
,
132 css::uno::Sequence
<css::uno::Any
> const &)
134 return cppu::acquire(new SpinningProgressControlModel(context
));
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */