Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / toolkit / source / awt / xsimpleanimation.cxx
blobfb170c1bf73e2f8b1f935df671f46b20c5932a4d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "toolkit/awt/xsimpleanimation.hxx"
21 #include "toolkit/helper/property.hxx"
22 #include <tools/debug.hxx>
23 #include <vcl/throbber.hxx>
24 #include <vcl/svapp.hxx>
26 //........................................................................
27 namespace toolkit
29 //........................................................................
31 using namespace ::com::sun::star;
33 //====================================================================
34 //= XSimpleAnimation
35 //====================================================================
36 DBG_NAME( XSimpleAnimation )
38 //--------------------------------------------------------------------
39 XSimpleAnimation::XSimpleAnimation()
41 DBG_CTOR( XSimpleAnimation, NULL );
44 //--------------------------------------------------------------------
45 XSimpleAnimation::~XSimpleAnimation()
47 DBG_DTOR( XSimpleAnimation, NULL );
50 //--------------------------------------------------------------------
51 void SAL_CALL XSimpleAnimation::start() throw ( uno::RuntimeException )
53 SolarMutexGuard aGuard;
54 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
55 if ( pThrobber != NULL)
56 pThrobber->start();
59 //--------------------------------------------------------------------
60 void SAL_CALL XSimpleAnimation::stop() throw ( uno::RuntimeException )
62 SolarMutexGuard aGuard;
63 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
64 if ( pThrobber != NULL)
65 pThrobber->stop();
68 //--------------------------------------------------------------------
69 void SAL_CALL XSimpleAnimation::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& rImageList )
70 throw ( uno::RuntimeException )
72 SolarMutexGuard aGuard;
73 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
74 if ( pThrobber != NULL)
75 pThrobber->setImageList( rImageList );
78 //--------------------------------------------------------------------
79 void SAL_CALL XSimpleAnimation::setProperty( const ::rtl::OUString& PropertyName, const uno::Any& Value )
80 throw( uno::RuntimeException )
82 SolarMutexGuard aGuard;
84 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
85 if ( pThrobber == NULL )
87 VCLXWindow::setProperty( PropertyName, Value );
88 return;
91 sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
92 switch ( nPropertyId )
94 case BASEPROPERTY_STEP_TIME: {
95 sal_Int32 nStepTime( 0 );
96 if ( Value >>= nStepTime )
97 pThrobber->setStepTime( nStepTime );
99 break;
101 case BASEPROPERTY_REPEAT: {
102 sal_Bool bRepeat( sal_True );
103 if ( Value >>= bRepeat )
104 pThrobber->setRepeat( bRepeat );
105 break;
107 default:
108 VCLXWindow::setProperty( PropertyName, Value );
112 //--------------------------------------------------------------------
113 uno::Any SAL_CALL XSimpleAnimation::getProperty( const ::rtl::OUString& PropertyName )
114 throw( uno::RuntimeException )
116 SolarMutexGuard aGuard;
118 Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
119 if ( pThrobber == NULL )
120 return VCLXWindow::getProperty( PropertyName );
122 uno::Any aReturn;
123 sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
124 switch ( nPropertyId )
126 case BASEPROPERTY_STEP_TIME:
127 aReturn <<= pThrobber->getStepTime();
128 break;
129 case BASEPROPERTY_REPEAT:
130 aReturn <<= pThrobber->getRepeat();
131 break;
132 default:
133 aReturn = VCLXWindow::getProperty( PropertyName );
135 return aReturn;
138 //........................................................................
139 } // namespace toolkit
140 //........................................................................
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */