1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xsimpleanimation.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
33 #include "toolkit/awt/xsimpleanimation.hxx"
34 #include "toolkit/helper/property.hxx"
35 #include "toolkit/helper/throbberimpl.hxx"
36 #include <tools/debug.hxx>
38 //........................................................................
41 //........................................................................
43 using namespace ::com::sun::star
;
45 //====================================================================
47 //====================================================================
48 DBG_NAME( XSimpleAnimation
)
50 //--------------------------------------------------------------------
51 XSimpleAnimation::XSimpleAnimation()
53 DBG_CTOR( XSimpleAnimation
, NULL
);
56 mpThrobber
= new Throbber_Impl( this, mnStepTime
, mbRepeat
);
59 //--------------------------------------------------------------------
60 XSimpleAnimation::~XSimpleAnimation()
62 DBG_DTOR( XSimpleAnimation
, NULL
);
66 //--------------------------------------------------------------------
67 IMPLEMENT_FORWARD_XINTERFACE2( XSimpleAnimation
, VCLXWindow
, XSimpleAnimation_Base
)
69 //--------------------------------------------------------------------
70 IMPLEMENT_FORWARD_XTYPEPROVIDER2( XSimpleAnimation
, VCLXWindow
, XSimpleAnimation_Base
)
72 //--------------------------------------------------------------------
73 void SAL_CALL
XSimpleAnimation::start() throw ( uno::RuntimeException
)
78 //--------------------------------------------------------------------
79 void SAL_CALL
XSimpleAnimation::stop() throw ( uno::RuntimeException
)
84 //--------------------------------------------------------------------
85 void SAL_CALL
XSimpleAnimation::setImageList( const uno::Sequence
< uno::Reference
< graphic::XGraphic
> >& rImageList
)
86 throw ( uno::RuntimeException
)
88 mpThrobber
->setImageList( rImageList
);
91 //--------------------------------------------------------------------
92 void XSimpleAnimation::ProcessWindowEvent( const VclWindowEvent
& _rVclWindowEvent
)
94 // TODO: XSimpleAnimation::ProcessWindowEvent
95 //::vos::OClearableGuard aGuard( GetMutex() );
96 //Reference< XSimpleAnimation > xKeepAlive( this );
97 //SpinButton* pSpinButton = static_cast< SpinButton* >( GetWindow() );
101 VCLXWindow::ProcessWindowEvent( _rVclWindowEvent
);
104 //--------------------------------------------------------------------
105 void SAL_CALL
XSimpleAnimation::setProperty( const ::rtl::OUString
& PropertyName
, const uno::Any
& Value
)
106 throw( uno::RuntimeException
)
108 ::vos::OGuard
aGuard( GetMutex() );
112 sal_uInt16 nPropertyId
= GetPropertyId( PropertyName
);
113 switch ( nPropertyId
)
115 case BASEPROPERTY_STEP_TIME
: {
116 sal_Int32
nStepTime( 0 );
117 if ( Value
>>= nStepTime
)
119 mnStepTime
= nStepTime
;
120 mpThrobber
->setStepTime( mnStepTime
);
125 case BASEPROPERTY_REPEAT
: {
126 sal_Bool
bRepeat( sal_True
);
127 if ( Value
>>= bRepeat
)
130 mpThrobber
->setRepeat( mbRepeat
);
135 VCLXWindow::setProperty( PropertyName
, Value
);
140 //--------------------------------------------------------------------
141 uno::Any SAL_CALL
XSimpleAnimation::getProperty( const ::rtl::OUString
& PropertyName
)
142 throw( uno::RuntimeException
)
144 ::vos::OGuard
aGuard( GetMutex() );
150 sal_uInt16 nPropertyId
= GetPropertyId( PropertyName
);
151 switch ( nPropertyId
)
153 case BASEPROPERTY_STEP_TIME
:
154 aReturn
<<= mnStepTime
;
156 case BASEPROPERTY_REPEAT
:
157 aReturn
<<= mbRepeat
;
160 aReturn
= VCLXWindow::getProperty( PropertyName
);
166 //........................................................................
167 } // namespace toolkit
168 //........................................................................