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 : /** === begin UNO using === **/
36 : using ::com::sun::star::uno::Reference;
37 : using ::com::sun::star::uno::XInterface;
38 : using ::com::sun::star::uno::UNO_QUERY;
39 : using ::com::sun::star::uno::UNO_QUERY_THROW;
40 : using ::com::sun::star::uno::UNO_SET_THROW;
41 : using ::com::sun::star::uno::Exception;
42 : using ::com::sun::star::uno::RuntimeException;
43 : using ::com::sun::star::uno::Any;
44 : using ::com::sun::star::uno::makeAny;
45 : using ::com::sun::star::uno::Sequence;
46 : using ::com::sun::star::uno::Type;
47 : using ::com::sun::star::beans::XPropertySetInfo;
48 : using ::com::sun::star::lang::XMultiServiceFactory;
49 : /** === end UNO using === **/
50 :
51 : //==================================================================================================================
52 : //= SpinningProgressControlModel
53 : //==================================================================================================================
54 : //------------------------------------------------------------------------------------------------------------------
55 0 : SpinningProgressControlModel::SpinningProgressControlModel( Reference< XMultiServiceFactory > const & i_factory )
56 0 : :SpinningProgressControlModel_Base( i_factory )
57 : {
58 : // default image sets
59 0 : osl_atomic_increment( &m_refCount );
60 : {
61 : try
62 : {
63 : Throbber::ImageSet aImageSets[] =
64 : {
65 : Throbber::IMAGES_16_PX, Throbber::IMAGES_32_PX, Throbber::IMAGES_64_PX
66 0 : };
67 0 : for ( size_t i=0; i < sizeof( aImageSets ) / sizeof( aImageSets[0] ); ++i )
68 : {
69 0 : const ::std::vector< ::rtl::OUString > aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets[i] ) );
70 0 : const Sequence< ::rtl::OUString > aImageURLs( &aDefaultURLs[0], aDefaultURLs.size() );
71 0 : insertImageSet( i, aImageURLs );
72 0 : }
73 : }
74 0 : catch( const Exception& )
75 : {
76 : DBG_UNHANDLED_EXCEPTION();
77 : }
78 : }
79 0 : osl_atomic_decrement( &m_refCount );
80 0 : }
81 :
82 : //------------------------------------------------------------------------------------------------------------------
83 0 : SpinningProgressControlModel::SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource )
84 0 : :SpinningProgressControlModel_Base( i_copySource )
85 : {
86 0 : }
87 :
88 : //------------------------------------------------------------------------------------------------------------------
89 0 : SpinningProgressControlModel::~SpinningProgressControlModel()
90 : {
91 0 : }
92 :
93 : //------------------------------------------------------------------------------------------------------------------
94 0 : UnoControlModel* SpinningProgressControlModel::Clone() const
95 : {
96 0 : return new SpinningProgressControlModel( *this );
97 : }
98 :
99 : //------------------------------------------------------------------------------------------------------------------
100 0 : Reference< XPropertySetInfo > SAL_CALL SpinningProgressControlModel::getPropertySetInfo( ) throw(RuntimeException)
101 : {
102 0 : static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
103 0 : return xInfo;
104 : }
105 :
106 : //------------------------------------------------------------------------------------------------------------------
107 0 : ::rtl::OUString SAL_CALL SpinningProgressControlModel::getServiceName() throw(RuntimeException)
108 : {
109 0 : return ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
110 : }
111 :
112 : //------------------------------------------------------------------------------------------------------------------
113 0 : ::rtl::OUString SAL_CALL SpinningProgressControlModel::getImplementationName( ) throw(RuntimeException)
114 : {
115 0 : return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.toolkit.SpinningProgressControlModel"));
116 : }
117 :
118 : //------------------------------------------------------------------------------------------------------------------
119 0 : Sequence< ::rtl::OUString > SAL_CALL SpinningProgressControlModel::getSupportedServiceNames() throw(RuntimeException)
120 : {
121 0 : Sequence< ::rtl::OUString > aServiceNames(3);
122 0 : aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
123 0 : aServiceNames[1] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
124 0 : aServiceNames[2] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlModel"));
125 0 : return aServiceNames;
126 : }
127 :
128 : //......................................................................................................................
129 : } // namespace toolkit
130 : //......................................................................................................................
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|