2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
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
|
|
|
* 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
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include "toolkit/controls/tkthrobber.hxx"
|
|
|
|
#include "toolkit/helper/property.hxx"
|
|
|
|
#include "toolkit/helper/unopropertyarrayhelper.hxx"
|
|
|
|
#include <cppuhelper/typeprovider.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
|
|
|
|
//====================================================================
|
|
|
|
//--------------------------------------------------------------------
|
2010-12-06 14:14:11 +01:00
|
|
|
UnoThrobberControlModel::UnoThrobberControlModel( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
|
|
|
|
:UnoControlModel( i_factory )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
2010-06-10 13:44:35 +02:00
|
|
|
ImplRegisterProperty( BASEPROPERTY_BORDER );
|
|
|
|
ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
|
2007-01-18 13:44:21 +00:00
|
|
|
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
|
2010-06-10 13:44:35 +02:00
|
|
|
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
|
|
|
|
ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
|
|
|
|
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
|
|
|
|
ImplRegisterProperty( BASEPROPERTY_HELPURL );
|
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 ) );
|
2010-06-10 13:44:35 +02:00
|
|
|
case BASEPROPERTY_BORDER:
|
|
|
|
return uno::makeAny( (sal_Int16) 0 );
|
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() );
|
2009-10-07 14:13:55 +00:00
|
|
|
aServices.realloc( aServices.getLength() + 2 );
|
2012-05-07 23:25:48 +02:00
|
|
|
aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 2] =
|
|
|
|
::rtl::OUString::createFromAscii(szServiceName_UnoThrobberControlModel);
|
|
|
|
aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 1] =
|
|
|
|
::rtl::OUString::createFromAscii(szServiceName2_UnoThrobberControlModel);
|
2006-12-20 12:53:37 +00:00
|
|
|
return aServices;
|
|
|
|
}
|
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
//= UnoThrobberControl
|
|
|
|
//====================================================================
|
|
|
|
//--------------------------------------------------------------------
|
2010-12-06 14:14:11 +01:00
|
|
|
UnoThrobberControl::UnoThrobberControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
|
|
|
|
:UnoControlBase( i_factory )
|
2006-12-20 12:53:37 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
::rtl::OUString UnoThrobberControl::GetComponentServiceName()
|
|
|
|
{
|
2010-11-22 22:47:26 +01:00
|
|
|
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Throbber"));
|
2006-12-20 12:53:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
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() );
|
2009-10-07 14:13:55 +00:00
|
|
|
aServices.realloc( aServices.getLength() + 2 );
|
2012-05-07 23:25:48 +02:00
|
|
|
aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 2] =
|
|
|
|
::rtl::OUString::createFromAscii(szServiceName_UnoThrobberControl);
|
|
|
|
aServices[sal::static_int_cast<sal_uInt32>(aServices.getLength()) - 1] =
|
|
|
|
::rtl::OUString::createFromAscii(szServiceName2_UnoThrobberControl);
|
2006-12-20 12:53:37 +00:00
|
|
|
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
|
|
|
|
//........................................................................
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|