Line data Source code
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 :
21 : #include "toolkit/controls/spinningprogress.hxx"
22 : #include "toolkit/helper/servicenames.hxx"
23 : #include "toolkit/helper/unopropertyarrayhelper.hxx"
24 :
25 :
26 : #include <rtl/ustrbuf.hxx>
27 : #include <tools/diagnose_ex.h>
28 : #include <vcl/throbber.hxx>
29 :
30 : //......................................................................................................................
31 : namespace toolkit
32 : {
33 : //......................................................................................................................
34 :
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;
48 :
49 : //==================================================================================================================
50 : //= SpinningProgressControlModel
51 : //==================================================================================================================
52 : //------------------------------------------------------------------------------------------------------------------
53 0 : SpinningProgressControlModel::SpinningProgressControlModel( Reference< XComponentContext > const & i_factory )
54 0 : :SpinningProgressControlModel_Base( i_factory )
55 : {
56 : // default image sets
57 0 : osl_atomic_increment( &m_refCount );
58 : {
59 : try
60 : {
61 : Throbber::ImageSet aImageSets[] =
62 : {
63 : Throbber::IMAGES_16_PX, Throbber::IMAGES_32_PX, Throbber::IMAGES_64_PX
64 0 : };
65 0 : for ( size_t i=0; i < sizeof( aImageSets ) / sizeof( aImageSets[0] ); ++i )
66 : {
67 0 : const ::std::vector< OUString > aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets[i] ) );
68 0 : const Sequence< OUString > aImageURLs( &aDefaultURLs[0], aDefaultURLs.size() );
69 0 : insertImageSet( i, aImageURLs );
70 0 : }
71 : }
72 0 : catch( const Exception& )
73 : {
74 : DBG_UNHANDLED_EXCEPTION();
75 : }
76 : }
77 0 : osl_atomic_decrement( &m_refCount );
78 0 : }
79 :
80 : //------------------------------------------------------------------------------------------------------------------
81 0 : SpinningProgressControlModel::SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource )
82 0 : :SpinningProgressControlModel_Base( i_copySource )
83 : {
84 0 : }
85 :
86 : //------------------------------------------------------------------------------------------------------------------
87 0 : SpinningProgressControlModel::~SpinningProgressControlModel()
88 : {
89 0 : }
90 :
91 : //------------------------------------------------------------------------------------------------------------------
92 0 : UnoControlModel* SpinningProgressControlModel::Clone() const
93 : {
94 0 : return new SpinningProgressControlModel( *this );
95 : }
96 :
97 : //------------------------------------------------------------------------------------------------------------------
98 0 : Reference< XPropertySetInfo > SAL_CALL SpinningProgressControlModel::getPropertySetInfo( ) throw(RuntimeException)
99 : {
100 0 : static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
101 0 : return xInfo;
102 : }
103 :
104 : //------------------------------------------------------------------------------------------------------------------
105 0 : OUString SAL_CALL SpinningProgressControlModel::getServiceName() throw(RuntimeException)
106 : {
107 0 : return OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
108 : }
109 :
110 : //------------------------------------------------------------------------------------------------------------------
111 0 : OUString SAL_CALL SpinningProgressControlModel::getImplementationName( ) throw(RuntimeException)
112 : {
113 0 : return OUString("org.openoffice.comp.toolkit.SpinningProgressControlModel");
114 : }
115 :
116 : //------------------------------------------------------------------------------------------------------------------
117 0 : Sequence< OUString > SAL_CALL SpinningProgressControlModel::getSupportedServiceNames() throw(RuntimeException)
118 : {
119 0 : Sequence< OUString > aServiceNames(3);
120 0 : aServiceNames[0] = OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
121 0 : aServiceNames[1] = OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
122 0 : aServiceNames[2] = "com.sun.star.awt.UnoControlModel";
123 0 : return aServiceNames;
124 : }
125 :
126 : //......................................................................................................................
127 465 : } // namespace toolkit
128 : //......................................................................................................................
129 :
130 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|