Kaydet (Commit) f139c10f authored tarafından Alexandre Vicenzi's avatar Alexandre Vicenzi Kaydeden (comit) Marcos Souza

fdo#54938 Convert oox, sc, vcl, svtools... to cppu::supportsService

Change-Id: I6268bc57417d53b9810c81071fbcd604e2a19507
Reviewed-on: https://gerrit.libreoffice.org/7886Tested-by: 's avatarLibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: 's avatarMarcos Souza <marcos.souza.org@gmail.com>
üst 61e28e86
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <com/sun/star/test/performance/XPerformanceTest.hpp> #include <com/sun/star/test/performance/XPerformanceTest.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/weak.hxx> #include <cppuhelper/weak.hxx>
#include <cppuhelper/supportsservice.hxx>
using namespace ::test; using namespace ::test;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
...@@ -252,10 +253,10 @@ OUString ServiceImpl::getImplementationName() ...@@ -252,10 +253,10 @@ OUString ServiceImpl::getImplementationName()
return OUString( ); return OUString( );
} }
sal_Bool ServiceImpl::supportsService( const OUString & /* rServiceName */) sal_Bool ServiceImpl::supportsService( const OUString & rServiceName )
throw (RuntimeException) throw (RuntimeException)
{ {
return sal_False; return cppu::supportsService(this, rServiceName);
} }
Sequence< OUString > ServiceImpl::getSupportedServiceNames() Sequence< OUString > ServiceImpl::getSupportedServiceNames()
...@@ -610,7 +611,6 @@ void testAllTypes( const Reference < XCallMe > & rRCallMe ) ...@@ -610,7 +611,6 @@ void testAllTypes( const Reference < XCallMe > & rRCallMe )
OSL_ASSERT( types.Interface == retTypes.Interface ); OSL_ASSERT( types.Interface == retTypes.Interface );
OSL_ASSERT( types.Any == retTypes.Any ); OSL_ASSERT( types.Any == retTypes.Any );
} }
} }
void testRemote( const Reference< XInterface > &rRemote ) void testRemote( const Reference< XInterface > &rRemote )
...@@ -636,9 +636,7 @@ void testRemote( const Reference< XInterface > &rRemote ) ...@@ -636,9 +636,7 @@ void testRemote( const Reference< XInterface > &rRemote )
printf( "Testing exception remote ...\n" ); printf( "Testing exception remote ...\n" );
testException( rRCallMe ); testException( rRCallMe );
//--------------------
// Test attributes // Test attributes
//----------------------
OUString ow( "dum didel dum dideldei" ); OUString ow( "dum didel dum dideldei" );
rLCallMe->setsAttribute( ow ); rLCallMe->setsAttribute( ow );
OSL_ASSERT( rLCallMe->getsAttribute() == ow ); OSL_ASSERT( rLCallMe->getsAttribute() == ow );
...@@ -646,15 +644,11 @@ void testRemote( const Reference< XInterface > &rRemote ) ...@@ -646,15 +644,11 @@ void testRemote( const Reference< XInterface > &rRemote )
rRCallMe->setsAttribute( ow ); rRCallMe->setsAttribute( ow );
OSL_ASSERT( rRCallMe->getsAttribute() == ow ); OSL_ASSERT( rRCallMe->getsAttribute() == ow );
//-------------------
// Performance test // Performance test
//-------------------
testPerformance( rRCallMe , rLCallMe ); testPerformance( rRCallMe , rLCallMe );
testOnewayPerformanceOnTwoInterfaces( rRFact->createCallMe(), rRCallMe ); testOnewayPerformanceOnTwoInterfaces( rRFact->createCallMe(), rRCallMe );
//----------------
// Test sequence // Test sequence
//----------------
testSequenceOfCalls( rRCallMe ); testSequenceOfCalls( rRCallMe );
...@@ -704,9 +698,7 @@ void testRemote( const Reference< XInterface > &rRemote ) ...@@ -704,9 +698,7 @@ void testRemote( const Reference< XInterface > &rRemote )
// test empty references // test empty references
rRTest->setIn( Reference < XCallMe > () ); rRTest->setIn( Reference < XCallMe > () );
//--------------------------------
// test thread deadlocking // test thread deadlocking
//--------------------------------
rLCallMe->callAgain( rRCallMe, 20 ); rLCallMe->callAgain( rRCallMe, 20 );
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "oox/vml/vmlshape.hxx" #include "oox/vml/vmlshape.hxx"
#include "oox/drawingml/themefragmenthandler.hxx" #include "oox/drawingml/themefragmenthandler.hxx"
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <cppuhelper/supportsservice.hxx>
namespace oox { namespace shape { namespace oox { namespace shape {
...@@ -547,8 +548,7 @@ OUString SAL_CALL ShapeContextHandler::getRelationFragmentPath() ...@@ -547,8 +548,7 @@ OUString SAL_CALL ShapeContextHandler::getRelationFragmentPath()
return msRelationFragmentPath; return msRelationFragmentPath;
} }
void SAL_CALL ShapeContextHandler::setRelationFragmentPath void SAL_CALL ShapeContextHandler::setRelationFragmentPath(const OUString & the_value)
(const OUString & the_value)
throw (uno::RuntimeException) throw (uno::RuntimeException)
{ {
msRelationFragmentPath = the_value; msRelationFragmentPath = the_value;
...@@ -562,8 +562,6 @@ void SAL_CALL ShapeContextHandler::setRelationFragmentPath ...@@ -562,8 +562,6 @@ void SAL_CALL ShapeContextHandler::setRelationFragmentPath
void SAL_CALL ShapeContextHandler::setStartToken( ::sal_Int32 _starttoken ) throw (::com::sun::star::uno::RuntimeException) void SAL_CALL ShapeContextHandler::setStartToken( ::sal_Int32 _starttoken ) throw (::com::sun::star::uno::RuntimeException)
{ {
mnStartToken = _starttoken; mnStartToken = _starttoken;
} }
awt::Point SAL_CALL ShapeContextHandler::getPosition() throw (uno::RuntimeException) awt::Point SAL_CALL ShapeContextHandler::getPosition() throw (uno::RuntimeException)
...@@ -588,15 +586,10 @@ uno::Sequence< OUString > ShapeContextHandler::getSupportedServiceNames() ...@@ -588,15 +586,10 @@ uno::Sequence< OUString > ShapeContextHandler::getSupportedServiceNames()
return ShapeContextHandler_getSupportedServiceNames(); return ShapeContextHandler_getSupportedServiceNames();
} }
::sal_Bool SAL_CALL ShapeContextHandler::supportsService ::sal_Bool SAL_CALL ShapeContextHandler::supportsService(const OUString & ServiceName)
(const OUString & ServiceName) throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
uno::Sequence< OUString > aSeq = getSupportedServiceNames(); return cppu::supportsService(this, ServiceName);
if (aSeq[0].equals(ServiceName))
return sal_True;
return sal_False;
} }
}} }}
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase2.hxx>
#include <com/sun/star/xml/sax/XFastShapeContextHandler.hpp> #include <com/sun/star/xml/sax/XFastShapeContextHandler.hpp>
#include "oox/drawingml/graphicshapecontext.hxx" #include "oox/drawingml/graphicshapecontext.hxx"
#include "oox/drawingml/shape.hxx" #include "oox/drawingml/shape.hxx"
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "oox/core/fragmenthandler2.hxx" #include "oox/core/fragmenthandler2.hxx"
#include "oox/core/xmlfilterbase.hxx" #include "oox/core/xmlfilterbase.hxx"
#include "ShapeFilterBase.hxx" #include "ShapeFilterBase.hxx"
#include <com/sun/star/lang/XServiceInfo.hpp>
namespace oox { namespace shape { namespace oox { namespace shape {
...@@ -45,8 +46,8 @@ public: ...@@ -45,8 +46,8 @@ public:
}; };
class ShapeContextHandler: class ShapeContextHandler:
public ::cppu::WeakImplHelper1< public ::cppu::WeakImplHelper2< css::xml::sax::XFastShapeContextHandler,
css::xml::sax::XFastShapeContextHandler> css::lang::XServiceInfo >
{ {
public: public:
explicit ShapeContextHandler explicit ShapeContextHandler
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/container/XIndexAccess.hpp>
#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase2.hxx>
#include <cppuhelper/supportsservice.hxx>
#include "scdllapi.h" #include "scdllapi.h"
#define SC_SIMPLE_SERVICE_INFO( ClassName, ClassNameAscii, ServiceAscii ) \ #define SC_SIMPLE_SERVICE_INFO( ClassName, ClassNameAscii, ServiceAscii ) \
...@@ -38,7 +39,7 @@ OUString SAL_CALL ClassName::getImplementationName() \ ...@@ -38,7 +39,7 @@ OUString SAL_CALL ClassName::getImplementationName() \
sal_Bool SAL_CALL ClassName::supportsService( const OUString& ServiceName ) \ sal_Bool SAL_CALL ClassName::supportsService( const OUString& ServiceName ) \
throw(::com::sun::star::uno::RuntimeException) \ throw(::com::sun::star::uno::RuntimeException) \
{ \ { \
return !ServiceName.compareToAscii(ServiceAscii); \ return cppu::supportsService(this, ServiceName); \
} \ } \
::com::sun::star::uno::Sequence< OUString > \ ::com::sun::star::uno::Sequence< OUString > \
SAL_CALL ClassName::getSupportedServiceNames(void) \ SAL_CALL ClassName::getSupportedServiceNames(void) \
......
...@@ -707,15 +707,7 @@ OUString SAL_CALL SvUnoImageMap::getImplementationName( ) ...@@ -707,15 +707,7 @@ OUString SAL_CALL SvUnoImageMap::getImplementationName( )
sal_Bool SAL_CALL SvUnoImageMap::supportsService( const OUString& ServiceName ) sal_Bool SAL_CALL SvUnoImageMap::supportsService( const OUString& ServiceName )
throw(RuntimeException) throw(RuntimeException)
{ {
const Sequence< OUString > aSNL( getSupportedServiceNames() ); return cppu::supportsService(this, ServiceName);
const OUString * pArray = aSNL.getConstArray();
const sal_Int32 nCount = aSNL.getLength();
for( sal_Int32 i = 0; i < nCount; i++ )
if( pArray[i] == ServiceName )
return sal_True;
return sal_False;
} }
Sequence< OUString > SAL_CALL SvUnoImageMap::getSupportedServiceNames( ) Sequence< OUString > SAL_CALL SvUnoImageMap::getSupportedServiceNames( )
......
...@@ -334,9 +334,9 @@ OUString SAL_CALL AquaClipboard::getImplementationName() throw( RuntimeException ...@@ -334,9 +334,9 @@ OUString SAL_CALL AquaClipboard::getImplementationName() throw( RuntimeException
return clipboard_getImplementationName(); return clipboard_getImplementationName();
} }
sal_Bool SAL_CALL AquaClipboard::supportsService( const OUString& /*ServiceName*/ ) throw( RuntimeException ) sal_Bool SAL_CALL AquaClipboard::supportsService( const OUString& ServiceName ) throw( RuntimeException )
{ {
return sal_False; return cppu::supportsService(this, ServiceName);
} }
Sequence< OUString > SAL_CALL AquaClipboard::getSupportedServiceNames() throw( RuntimeException ) Sequence< OUString > SAL_CALL AquaClipboard::getSupportedServiceNames() throw( RuntimeException )
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx> #include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase4.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/xml/input/XAttributes.hpp> #include <com/sun/star/xml/input/XAttributes.hpp>
#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <vector> #include <vector>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
...@@ -91,9 +91,10 @@ struct MGuard ...@@ -91,9 +91,10 @@ struct MGuard
}; };
class DocumentHandlerImpl : class DocumentHandlerImpl :
public ::cppu::WeakImplHelper3< xml::sax::XDocumentHandler, public ::cppu::WeakImplHelper4< xml::sax::XDocumentHandler,
xml::input::XNamespaceMapping, xml::input::XNamespaceMapping,
lang::XInitialization > lang::XInitialization,
com::sun::star::lang::XServiceInfo >
{ {
friend class ExtendedAttributes; friend class ExtendedAttributes;
...@@ -413,17 +414,10 @@ OUString DocumentHandlerImpl::getImplementationName() ...@@ -413,17 +414,10 @@ OUString DocumentHandlerImpl::getImplementationName()
return getImplementationName_DocumentHandlerImpl(); return getImplementationName_DocumentHandlerImpl();
} }
sal_Bool DocumentHandlerImpl::supportsService( sal_Bool DocumentHandlerImpl::supportsService( OUString const & servicename )
OUString const & servicename )
throw (RuntimeException) throw (RuntimeException)
{ {
Sequence< OUString > names( getSupportedServiceNames_DocumentHandlerImpl() ); return cppu::supportsService(this, servicename);
for ( sal_Int32 nPos = names.getLength(); nPos--; )
{
if (names[ nPos ].equals( servicename ))
return sal_True;
}
return sal_False;
} }
Sequence< OUString > DocumentHandlerImpl::getSupportedServiceNames() Sequence< OUString > DocumentHandlerImpl::getSupportedServiceNames()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment