Branch data 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 : : #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>
25 : :
26 : : //........................................................................
27 : : namespace toolkit
28 : : {
29 : : //........................................................................
30 : :
31 : : using namespace ::com::sun::star;
32 : :
33 : : //====================================================================
34 : : //= XSimpleAnimation
35 : : //====================================================================
36 : : DBG_NAME( XSimpleAnimation )
37 : :
38 : : //--------------------------------------------------------------------
39 : 0 : XSimpleAnimation::XSimpleAnimation()
40 : : {
41 : : DBG_CTOR( XSimpleAnimation, NULL );
42 : 0 : }
43 : :
44 : : //--------------------------------------------------------------------
45 : 0 : XSimpleAnimation::~XSimpleAnimation()
46 : : {
47 : : DBG_DTOR( XSimpleAnimation, NULL );
48 [ # # ]: 0 : }
49 : :
50 : : //--------------------------------------------------------------------
51 : 0 : void SAL_CALL XSimpleAnimation::start() throw ( uno::RuntimeException )
52 : : {
53 [ # # ]: 0 : SolarMutexGuard aGuard;
54 [ # # ]: 0 : Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
55 [ # # ]: 0 : if ( pThrobber != NULL)
56 [ # # ][ # # ]: 0 : pThrobber->start();
57 : 0 : }
58 : :
59 : : //--------------------------------------------------------------------
60 : 0 : void SAL_CALL XSimpleAnimation::stop() throw ( uno::RuntimeException )
61 : : {
62 [ # # ]: 0 : SolarMutexGuard aGuard;
63 [ # # ]: 0 : Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
64 [ # # ]: 0 : if ( pThrobber != NULL)
65 [ # # ][ # # ]: 0 : pThrobber->stop();
66 : 0 : }
67 : :
68 : : //--------------------------------------------------------------------
69 : 0 : void SAL_CALL XSimpleAnimation::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& rImageList )
70 : : throw ( uno::RuntimeException )
71 : : {
72 [ # # ]: 0 : SolarMutexGuard aGuard;
73 [ # # ]: 0 : Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
74 [ # # ]: 0 : if ( pThrobber != NULL)
75 [ # # ][ # # ]: 0 : pThrobber->setImageList( rImageList );
76 : 0 : }
77 : :
78 : : //--------------------------------------------------------------------
79 : 0 : void SAL_CALL XSimpleAnimation::setProperty( const ::rtl::OUString& PropertyName, const uno::Any& Value )
80 : : throw( uno::RuntimeException )
81 : : {
82 [ # # ]: 0 : SolarMutexGuard aGuard;
83 : :
84 [ # # ]: 0 : Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
85 [ # # ]: 0 : if ( pThrobber == NULL )
86 : : {
87 [ # # ]: 0 : VCLXWindow::setProperty( PropertyName, Value );
88 : 0 : return;
89 : : }
90 : :
91 [ # # ]: 0 : sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
92 [ # # # ]: 0 : switch ( nPropertyId )
93 : : {
94 : : case BASEPROPERTY_STEP_TIME: {
95 : 0 : sal_Int32 nStepTime( 0 );
96 [ # # ]: 0 : if ( Value >>= nStepTime )
97 : 0 : pThrobber->setStepTime( nStepTime );
98 : :
99 : : break;
100 : : }
101 : : case BASEPROPERTY_REPEAT: {
102 : 0 : sal_Bool bRepeat( sal_True );
103 [ # # ]: 0 : if ( Value >>= bRepeat )
104 : 0 : pThrobber->setRepeat( bRepeat );
105 : : break;
106 : : }
107 : : default:
108 [ # # ]: 0 : VCLXWindow::setProperty( PropertyName, Value );
109 [ # # ][ # # ]: 0 : }
110 : : }
111 : :
112 : : //--------------------------------------------------------------------
113 : 0 : uno::Any SAL_CALL XSimpleAnimation::getProperty( const ::rtl::OUString& PropertyName )
114 : : throw( uno::RuntimeException )
115 : : {
116 [ # # ]: 0 : SolarMutexGuard aGuard;
117 : :
118 [ # # ]: 0 : Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
119 [ # # ]: 0 : if ( pThrobber == NULL )
120 [ # # ]: 0 : return VCLXWindow::getProperty( PropertyName );
121 : :
122 : 0 : uno::Any aReturn;
123 [ # # ]: 0 : sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
124 [ # # # ]: 0 : switch ( nPropertyId )
125 : : {
126 : : case BASEPROPERTY_STEP_TIME:
127 [ # # ]: 0 : aReturn <<= pThrobber->getStepTime();
128 : 0 : break;
129 : : case BASEPROPERTY_REPEAT:
130 [ # # ]: 0 : aReturn <<= pThrobber->getRepeat();
131 : 0 : break;
132 : : default:
133 [ # # ]: 0 : aReturn = VCLXWindow::getProperty( PropertyName );
134 : : }
135 [ # # ]: 0 : return aReturn;
136 : : }
137 : :
138 : : //........................................................................
139 : : } // namespace toolkit
140 : : //........................................................................
141 : :
142 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|