2006-12-20 12:53:37 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 08:28:23 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2006-12-20 12:53:37 +00:00
|
|
|
*
|
2008-04-11 08:28:23 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2006-12-20 12:53:37 +00:00
|
|
|
*
|
2008-04-11 08:28:23 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2006-12-20 12:53:37 +00:00
|
|
|
*
|
2008-04-11 08:28:23 +00:00
|
|
|
* $RCSfile: tkthrobber.cxx,v $
|
|
|
|
* $Revision: 1.5 $
|
2006-12-20 12:53:37 +00:00
|
|
|
*
|
2008-04-11 08:28:23 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2006-12-20 12:53:37 +00:00
|
|
|
*
|
2008-04-11 08:28:23 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2006-12-20 12:53:37 +00:00
|
|
|
*
|
2008-04-11 08:28:23 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2006-12-20 12:53:37 +00:00
|
|
|
*
|
2008-04-11 08:28:23 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2006-12-20 12:53:37 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_toolkit.hxx"
|
|
|
|
#include "toolkit/controls/tkthrobber.hxx"
|
|
|
|
#include "toolkit/helper/property.hxx"
|
|
|
|
#include "toolkit/helper/unopropertyarrayhelper.hxx"
|
|
|
|
#include <cppuhelper/typeprovider.hxx>
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
|
|
|
|
//........................................................................
|
|
|
|
namespace toolkit
|
|
|
|
{
|
|
|
|
//........................................................................
|
|
|
|
|
2008-04-04 09:55:58 +00:00
|
|
|
using namespace ::com::sun::star;
|
2006-12-20 12:53:37 +00:00
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
//= UnoThrobberControlModel
|
|
|
|
//====================================================================
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
UnoThrobberControlModel::UnoThrobberControlModel()
|
|
|
|
{
|
|
|
|
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
|
2007-01-18 13:44:21 +00:00
|
|
|
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
|
2006-12-20 12:53:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
::rtl::OUString UnoThrobberControlModel::getServiceName( ) throw ( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
|
|
|
return ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Any UnoThrobberControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
|
|
|
switch ( nPropId )
|
|
|
|
{
|
|
|
|
case BASEPROPERTY_DEFAULTCONTROL:
|
2008-04-04 09:55:58 +00:00
|
|
|
return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl ) );
|
2006-12-20 12:53:37 +00:00
|
|
|
default:
|
|
|
|
return UnoControlModel::ImplGetDefaultValue( nPropId );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
::cppu::IPropertyArrayHelper& UnoThrobberControlModel::getInfoHelper()
|
|
|
|
{
|
|
|
|
static UnoPropertyArrayHelper* pHelper = NULL;
|
|
|
|
if ( !pHelper )
|
|
|
|
{
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
|
2006-12-20 12:53:37 +00:00
|
|
|
pHelper = new UnoPropertyArrayHelper( aIDs );
|
|
|
|
}
|
|
|
|
return *pHelper;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Reference< beans::XPropertySetInfo > UnoThrobberControlModel::getPropertySetInfo()
|
|
|
|
throw( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
2008-04-04 09:55:58 +00:00
|
|
|
static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
2006-12-20 12:53:37 +00:00
|
|
|
return xInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
::rtl::OUString SAL_CALL UnoThrobberControlModel::getImplementationName()
|
|
|
|
throw( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
|
|
|
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoThrobberControlModel" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Sequence< ::rtl::OUString > SAL_CALL UnoThrobberControlModel::getSupportedServiceNames()
|
|
|
|
throw( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
|
2006-12-20 12:53:37 +00:00
|
|
|
aServices.realloc( aServices.getLength() + 1 );
|
|
|
|
aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
|
|
|
|
return aServices;
|
|
|
|
}
|
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
//= UnoThrobberControl
|
|
|
|
//====================================================================
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
UnoThrobberControl::UnoThrobberControl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
::rtl::OUString UnoThrobberControl::GetComponentServiceName()
|
|
|
|
{
|
|
|
|
return ::rtl::OUString::createFromAscii( "Throbber" );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Any UnoThrobberControl::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Any aRet = UnoControlBase::queryAggregation( rType );
|
2006-12-20 12:53:37 +00:00
|
|
|
if ( !aRet.hasValue() )
|
|
|
|
aRet = UnoThrobberControl_Base::queryInterface( rType );
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoThrobberControl, UnoControlBase, UnoThrobberControl_Base )
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
void UnoThrobberControl::dispose() throw( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
|
|
|
::osl::ClearableMutexGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
UnoControl::dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
::rtl::OUString SAL_CALL UnoThrobberControl::getImplementationName()
|
|
|
|
throw( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
|
|
|
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoThrobberControl" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Sequence< ::rtl::OUString > SAL_CALL UnoThrobberControl::getSupportedServiceNames()
|
|
|
|
throw( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
|
2006-12-20 12:53:37 +00:00
|
|
|
aServices.realloc( aServices.getLength() + 1 );
|
|
|
|
aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl );
|
|
|
|
return aServices;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
void UnoThrobberControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit,
|
|
|
|
const uno::Reference< awt::XWindowPeer > & rParentPeer )
|
|
|
|
throw( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
|
|
|
UnoControl::createPeer( rxToolkit, rParentPeer );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
void SAL_CALL UnoThrobberControl::start() throw ( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( GetMutex() );
|
|
|
|
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Reference< XThrobber > xAnimation( getPeer(), uno::UNO_QUERY );
|
2006-12-20 12:53:37 +00:00
|
|
|
if ( xAnimation.is() )
|
|
|
|
xAnimation->start();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-04-04 09:55:58 +00:00
|
|
|
void SAL_CALL UnoThrobberControl::stop() throw ( uno::RuntimeException )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( GetMutex() );
|
|
|
|
|
2008-04-04 09:55:58 +00:00
|
|
|
uno::Reference< XThrobber > xAnimation( getPeer(), uno::UNO_QUERY );
|
2006-12-20 12:53:37 +00:00
|
|
|
if ( xAnimation.is() )
|
|
|
|
xAnimation->stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
//........................................................................
|
|
|
|
} // namespace toolkit
|
|
|
|
//........................................................................
|
|
|
|
|