LibreOffice Module toolkit (master) 1
spinningprogress.cxx
Go to the documentation of this file.
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>
24
25using namespace css;
26using namespace css::uno;
27
28namespace {
29
30typedef toolkit::AnimatedImagesControlModel SpinningProgressControlModel_Base;
31class SpinningProgressControlModel : public SpinningProgressControlModel_Base
32{
33public:
34 explicit SpinningProgressControlModel( css::uno::Reference< css::uno::XComponentContext > const & i_factory );
35 SpinningProgressControlModel(const SpinningProgressControlModel& rOther) : SpinningProgressControlModel_Base(rOther) {}
36
37 virtual rtl::Reference<UnoControlModel> Clone() const override;
38
39 // XPropertySet
40 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
41
42 // XPersistObject
43 OUString SAL_CALL getServiceName() override;
44
45 // XServiceInfo
46 OUString SAL_CALL getImplementationName( ) override;
47 css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
48
49protected:
50 virtual ~SpinningProgressControlModel() override;
51};
52
53 SpinningProgressControlModel::SpinningProgressControlModel( Reference< XComponentContext > const & i_factory )
54 :SpinningProgressControlModel_Base( i_factory )
55 {
56 // default image sets
57 osl_atomic_increment( &m_refCount );
58 {
59 try
60 {
61 Throbber::ImageSet aImageSets[] =
62 {
63 Throbber::ImageSet::N16px, Throbber::ImageSet::N32px, Throbber::ImageSet::N64px
64 };
65 for ( size_t i=0; i < SAL_N_ELEMENTS(aImageSets); ++i )
66 {
67 const ::std::vector< OUString > aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets[i] ) );
68 const Sequence< OUString > aImageURLs( aDefaultURLs.data(), aDefaultURLs.size() );
69 insertImageSet( i, aImageURLs );
70 }
71 }
72 catch( const Exception& )
73 {
74 DBG_UNHANDLED_EXCEPTION("toolkit.controls");
75 }
76 }
77 osl_atomic_decrement( &m_refCount );
78 }
79
80
81 SpinningProgressControlModel::~SpinningProgressControlModel()
82 {
83 }
84
85
86 rtl::Reference<UnoControlModel> SpinningProgressControlModel::Clone() const
87 {
88 return new SpinningProgressControlModel( *this );
89 }
90
91
92 Reference< beans::XPropertySetInfo > SAL_CALL SpinningProgressControlModel::getPropertySetInfo( )
93 {
94 static Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
95 return xInfo;
96 }
97
98
99 OUString SAL_CALL SpinningProgressControlModel::getServiceName()
100 {
101 return "com.sun.star.awt.SpinningProgressControlModel";
102 }
103
104
105 OUString SAL_CALL SpinningProgressControlModel::getImplementationName( )
106 {
107 return "org.openoffice.comp.toolkit.SpinningProgressControlModel";
108 }
109
110
111 Sequence< OUString > SAL_CALL SpinningProgressControlModel::getSupportedServiceNames()
112 {
113 return { "com.sun.star.awt.SpinningProgressControlModel",
114 "com.sun.star.awt.AnimatedImagesControlModel",
115 "com.sun.star.awt.UnoControlModel" };
116 }
117
118}
119
120extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
122 css::uno::XComponentContext *context,
123 css::uno::Sequence<css::uno::Any> const &)
124{
125 return cppu::acquire(new SpinningProgressControlModel(context));
126}
127
128/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define DBG_UNHANDLED_EXCEPTION(...)
#define SAL_N_ELEMENTS(arr)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
int i
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * org_openoffice_comp_toolkit_SpinningProgressControlModel_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)