fdo#54938: Convert svtools to cppu::supportsService...

...final part

Conflicts:
	svtools/source/filter/SvFilterOptionsDialog.cxx

Change-Id: Ie4a0a7ea8ec65b3e632d06627bba40a26c9a7a91
This commit is contained in:
Marcos Paulo de Souza 2014-01-14 12:03:59 -02:00 committed by Matúš Kukan
parent 881c3dfaef
commit cf51afb026
6 changed files with 13 additions and 78 deletions

View File

@ -23,6 +23,7 @@
#include <com/sun/star/beans/PropertyChangeEvent.hpp> #include <com/sun/star/beans/PropertyChangeEvent.hpp>
#include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XWindow.hpp>
#include <comphelper/accessibleeventnotifier.hxx> #include <comphelper/accessibleeventnotifier.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/typeprovider.hxx>
#include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/vclunohelper.hxx>
#include <toolkit/helper/convert.hxx> #include <toolkit/helper/convert.hxx>
@ -362,7 +363,6 @@ sal_Int32 SvtRulerAccessible::getBackground( )
} }
//===== XServiceInfo ======================================================== //===== XServiceInfo ========================================================
OUString SAL_CALL SvtRulerAccessible::getImplementationName( void ) throw( RuntimeException ) OUString SAL_CALL SvtRulerAccessible::getImplementationName( void ) throw( RuntimeException )
{ {
return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.SvtRulerAccessible" ) ); return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.SvtRulerAccessible" ) );
@ -370,20 +370,7 @@ OUString SAL_CALL SvtRulerAccessible::getImplementationName( void ) throw( Runti
sal_Bool SAL_CALL SvtRulerAccessible::supportsService( const OUString& sServiceName ) throw( RuntimeException ) sal_Bool SAL_CALL SvtRulerAccessible::supportsService( const OUString& sServiceName ) throw( RuntimeException )
{ {
::osl::MutexGuard aGuard( m_aMutex ); return cppu::supportsService( this, sServiceName );
// Iterate over all supported service names and return true if on of them
// matches the given name.
Sequence< OUString > aSupportedServices( getSupportedServiceNames() );
int nLength = aSupportedServices.getLength();
const OUString* pStr = aSupportedServices.getConstArray();
for( int i = nLength ; i ; --i, ++pStr )
{
if( sServiceName == *pStr )
return sal_True;
}
return sal_False;
} }
Sequence< OUString > SAL_CALL SvtRulerAccessible::getSupportedServiceNames( void ) throw( RuntimeException ) Sequence< OUString > SAL_CALL SvtRulerAccessible::getSupportedServiceNames( void ) throw( RuntimeException )
@ -393,15 +380,12 @@ Sequence< OUString > SAL_CALL SvtRulerAccessible::getSupportedServiceNames( void
} }
//===== XTypeProvider ======================================================= //===== XTypeProvider =======================================================
Sequence< sal_Int8 > SAL_CALL SvtRulerAccessible::getImplementationId( void ) throw( RuntimeException ) Sequence< sal_Int8 > SAL_CALL SvtRulerAccessible::getImplementationId( void ) throw( RuntimeException )
{ {
return getUniqueId(); return getUniqueId();
} }
//===== internals ======================================================== //===== internals ========================================================
void SvtRulerAccessible::setName( const OUString& rName ) void SvtRulerAccessible::setName( const OUString& rName )
{ {
msName = rName; msName = rName;

View File

@ -22,6 +22,7 @@
#include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <unotools/accessiblestatesethelper.hxx> #include <unotools/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx> #include <unotools/accessiblerelationsethelper.hxx>
@ -143,30 +144,17 @@ void VCLXAccessibleHeaderBarItem::disposing()
AccessibleExtendedComponentHelper_BASE::disposing(); AccessibleExtendedComponentHelper_BASE::disposing();
} }
// -----------------------------------------------------------------------------
// XServiceInfo // XServiceInfo
// -----------------------------------------------------------------------------
OUString VCLXAccessibleHeaderBarItem::getImplementationName() throw (RuntimeException) OUString VCLXAccessibleHeaderBarItem::getImplementationName() throw (RuntimeException)
{ {
return OUString("com.sun.star.comp.svtools.AccessibleHeaderBarItem"); return OUString("com.sun.star.comp.svtools.AccessibleHeaderBarItem");
} }
// -----------------------------------------------------------------------------
sal_Bool VCLXAccessibleHeaderBarItem::supportsService( const OUString& rServiceName ) throw (RuntimeException) sal_Bool VCLXAccessibleHeaderBarItem::supportsService( const OUString& rServiceName ) throw (RuntimeException)
{ {
Sequence< OUString > aNames( getSupportedServiceNames() ); return cppu::supportsService( this, rServiceName );
const OUString* pNames = aNames.getConstArray();
const OUString* pEnd = pNames + aNames.getLength();
for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
;
return pNames != pEnd;
} }
// -----------------------------------------------------------------------------
Sequence< OUString > VCLXAccessibleHeaderBarItem::getSupportedServiceNames() throw (RuntimeException) Sequence< OUString > VCLXAccessibleHeaderBarItem::getSupportedServiceNames() throw (RuntimeException)
{ {
Sequence< OUString > aNames(1); Sequence< OUString > aNames(1);
@ -174,10 +162,7 @@ Sequence< OUString > VCLXAccessibleHeaderBarItem::getSupportedServiceNames() thr
return aNames; return aNames;
} }
// -----------------------------------------------------------------------------
// XAccessible // XAccessible
// -----------------------------------------------------------------------------
Reference< XAccessibleContext > VCLXAccessibleHeaderBarItem::getAccessibleContext() throw (RuntimeException) Reference< XAccessibleContext > VCLXAccessibleHeaderBarItem::getAccessibleContext() throw (RuntimeException)
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );

View File

@ -25,6 +25,7 @@
#include <vcl/graph.hxx> #include <vcl/graph.hxx>
#include "graphic.hxx" #include "graphic.hxx"
#include <comphelper/servicehelper.hxx> #include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <string.h> #include <string.h>
using namespace com::sun::star; using namespace com::sun::star;
@ -131,35 +132,17 @@ uno::Sequence< OUString > Graphic::getSupportedServiceNames_Static()
return aSeq; return aSeq;
} }
// ------------------------------------------------------------------------------
OUString SAL_CALL Graphic::getImplementationName() OUString SAL_CALL Graphic::getImplementationName()
throw( uno::RuntimeException ) throw( uno::RuntimeException )
{ {
return getImplementationName_Static(); return getImplementationName_Static();
} }
// ------------------------------------------------------------------------------
sal_Bool SAL_CALL Graphic::supportsService( const OUString& rServiceName ) sal_Bool SAL_CALL Graphic::supportsService( const OUString& rServiceName )
throw( uno::RuntimeException ) throw( uno::RuntimeException )
{ {
if( ::unographic::GraphicDescriptor::supportsService( rServiceName ) ) return cppu::supportsService( this, rServiceName );
return true;
else
{
uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
const OUString* pArray = aSNL.getConstArray();
for( int i = 0; i < aSNL.getLength(); i++ )
if( pArray[i] == rServiceName )
return true;
return false;
} }
}
// ------------------------------------------------------------------------------
uno::Sequence< OUString > SAL_CALL Graphic::getSupportedServiceNames() uno::Sequence< OUString > SAL_CALL Graphic::getSupportedServiceNames()
throw( uno::RuntimeException ) throw( uno::RuntimeException )
@ -176,8 +159,6 @@ uno::Sequence< OUString > SAL_CALL Graphic::getSupportedServiceNames()
return aRet; return aRet;
} }
// ------------------------------------------------------------------------------
uno::Sequence< uno::Type > SAL_CALL Graphic::getTypes() uno::Sequence< uno::Type > SAL_CALL Graphic::getTypes()
throw(uno::RuntimeException) throw(uno::RuntimeException)
{ {

View File

@ -34,6 +34,7 @@
#include <com/sun/star/io/XStream.hpp> #include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/text/GraphicCrop.hpp> #include <com/sun/star/text/GraphicCrop.hpp>
#include <comphelper/servicehelper.hxx> #include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include "descriptor.hxx" #include "descriptor.hxx"
#include "graphic.hxx" #include "graphic.hxx"
@ -51,37 +52,22 @@ GraphicProvider::GraphicProvider()
{ {
} }
// ------------------------------------------------------------------------------
GraphicProvider::~GraphicProvider() GraphicProvider::~GraphicProvider()
{ {
} }
// ------------------------------------------------------------------------------
OUString SAL_CALL GraphicProvider::getImplementationName() OUString SAL_CALL GraphicProvider::getImplementationName()
throw( uno::RuntimeException ) throw( uno::RuntimeException )
{ {
return OUString( "com.sun.star.comp.graphic.GraphicProvider" ); return OUString( "com.sun.star.comp.graphic.GraphicProvider" );
} }
// ------------------------------------------------------------------------------
sal_Bool SAL_CALL GraphicProvider::supportsService( const OUString& ServiceName ) sal_Bool SAL_CALL GraphicProvider::supportsService( const OUString& ServiceName )
throw( uno::RuntimeException ) throw( uno::RuntimeException )
{ {
uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); return cppu::supportsService( this, ServiceName );
const OUString* pArray = aSNL.getConstArray();
for( int i = 0; i < aSNL.getLength(); i++ )
if( pArray[i] == ServiceName )
return true;
return false;
} }
// ------------------------------------------------------------------------------
uno::Sequence< OUString > SAL_CALL GraphicProvider::getSupportedServiceNames() uno::Sequence< OUString > SAL_CALL GraphicProvider::getSupportedServiceNames()
throw( uno::RuntimeException ) throw( uno::RuntimeException )
{ {
@ -90,8 +76,6 @@ uno::Sequence< OUString > SAL_CALL GraphicProvider::getSupportedServiceNames()
return aSeq; return aSeq;
} }
// ------------------------------------------------------------------------------
uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes() uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes()
throw(uno::RuntimeException) throw(uno::RuntimeException)
{ {

View File

@ -20,14 +20,15 @@
#ifndef INCLUDED_SVTOOLS_SOURCE_INC_PROVIDER_HXX #ifndef INCLUDED_SVTOOLS_SOURCE_INC_PROVIDER_HXX
#define INCLUDED_SVTOOLS_SOURCE_INC_PROVIDER_HXX #define INCLUDED_SVTOOLS_SOURCE_INC_PROVIDER_HXX
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase2.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/awt/XBitmap.hpp>
namespace { namespace {
class GraphicProvider : public ::cppu::WeakImplHelper1< ::com::sun::star::graphic::XGraphicProvider > class GraphicProvider : public ::cppu::WeakImplHelper2< ::com::sun::star::graphic::XGraphicProvider,
::com::sun::star::lang::XServiceInfo >
{ {
public: public:

View File

@ -17,8 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <tools/rtti.hxx> #include <tools/rtti.hxx>
#include <tools/solar.h> #include <tools/solar.h>
@ -151,7 +151,7 @@ sal_Bool SvBaseEventDescriptor::hasElements()
sal_Bool SvBaseEventDescriptor::supportsService(const OUString& rServiceName) sal_Bool SvBaseEventDescriptor::supportsService(const OUString& rServiceName)
throw(RuntimeException) throw(RuntimeException)
{ {
return sServiceName.equals(rServiceName); return cppu::supportsService(this, rServiceName);
} }
Sequence<OUString> SvBaseEventDescriptor::getSupportedServiceNames(void) Sequence<OUString> SvBaseEventDescriptor::getSupportedServiceNames(void)