From 2b01553fa5982ed50fd37f346a150d1aac8dcd6f Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Sat, 26 Oct 2013 13:11:42 -0200 Subject: fdo#54938: Convert svx to use cppu::supportsService Change-Id: I3ab178924cb1c4240511f08625f244dac54e3913 Signed-off-by: Stephan Bergmann --- .../accessibility/AccessibleFrameSelector.cxx | 25 ++-------- .../accessibility/GraphCtlAccessibleContext.cxx | 21 +-------- .../accessibility/svxrectctaccessiblecontext.cxx | 15 +----- .../customshapes/EnhancedCustomShapeEngine.cxx | 16 ++----- svx/source/fmcomp/fmgridif.cxx | 11 +---- svx/source/form/formcontroller.cxx | 12 +---- svx/source/tbxctrls/tbunocontroller.cxx | 10 +--- svx/source/tbxctrls/tbunosearchcontrollers.cxx | 53 +++------------------- .../chinese_translation_unodialog.cxx | 24 ++-------- svx/source/unodraw/UnoGraphicExporter.cxx | 10 +--- svx/source/unodraw/UnoNameItemTable.cxx | 10 +--- svx/source/unodraw/XPropertyTable.cxx | 13 +----- svx/source/unodraw/recoveryui.cxx | 33 ++------------ svx/source/unodraw/unomod.cxx | 2 +- svx/source/unodraw/unomtabl.cxx | 10 +--- svx/source/unodraw/unopool.cxx | 11 +---- svx/source/unodraw/unoshape.cxx | 13 +----- svx/source/unogallery/unogalitem.cxx | 18 +------- svx/source/xml/xmlgrhlp.cxx | 8 ++-- 19 files changed, 53 insertions(+), 262 deletions(-) (limited to 'svx') diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx index 1a21e7cfd5dd..64dd1d1b497d 100644 --- a/svx/source/accessibility/AccessibleFrameSelector.cxx +++ b/svx/source/accessibility/AccessibleFrameSelector.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -552,50 +553,34 @@ void AccFrameSelector::removeAccessibleEventListener( const Reference< XAccessib } } -// ---------------------------------------------------------------------------- - OUString AccFrameSelector::getImplementationName( ) throw (RuntimeException) { return OUString("AccFrameSelector"); } -// ---------------------------------------------------------------------------- - -const sal_Char sAccessible[] = "Accessible"; -const sal_Char sAccessibleContext[] = "AccessibleContext"; -const sal_Char sAccessibleComponent[] = "AccessibleComponent"; - sal_Bool AccFrameSelector::supportsService( const OUString& rServiceName ) throw (RuntimeException) { - return rServiceName.equalsAsciiL( sAccessible , sizeof(sAccessible )-1 ) || - rServiceName.equalsAsciiL( sAccessibleContext , sizeof(sAccessibleContext )-1 ) || - rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 ); + return cppu::supportsService(this, rServiceName); } -// ---------------------------------------------------------------------------- - Sequence< OUString > AccFrameSelector::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< OUString > aRet(3); OUString* pArray = aRet.getArray(); - pArray[0] = OUString( sAccessible ); - pArray[1] = OUString( sAccessibleContext ); - pArray[2] = OUString( sAccessibleComponent ); + pArray[0] = OUString( "Accessible" ); + pArray[1] = OUString( "AccessibleContext" ); + pArray[2] = OUString( "AccessibleComponent" ); return aRet; } -// ---------------------------------------------------------------------------- - void AccFrameSelector::IsValid() throw (RuntimeException) { if(!mpFrameSel) throw RuntimeException(); } -// ---------------------------------------------------------------------------- - void AccFrameSelector::NotifyFocusListeners(sal_Bool bGetFocus) { SolarMutexGuard aGuard; diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index df0d9f8104a7..0b230a6faf61 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -555,33 +556,16 @@ sal_Int32 SAL_CALL SvxGraphCtrlAccessibleContext::getBackground (void) //===== XServiceInfo ======================================================== - OUString SAL_CALL SvxGraphCtrlAccessibleContext::getImplementationName( void ) throw( RuntimeException ) { return OUString( "com.sun.star.comp.ui.SvxGraphCtrlAccessibleContext" ); } -//----------------------------------------------------------------------------- - sal_Bool SAL_CALL SvxGraphCtrlAccessibleContext::supportsService( const OUString& sServiceName ) throw( RuntimeException ) { - ::SolarMutexGuard aGuard; - // Iterate over all supported service names and return true if on of them - // matches the given name. - Sequence< OUString > aSupportedServices( getSupportedServiceNames() ); - int nLenght = aSupportedServices.getLength(); - - for( int i = 0 ; i < nLenght ; ++i ) - { - if( sServiceName == aSupportedServices[ i ] ) - return sal_True; - } - - return sal_False; + return cppu::supportsService(this, sServiceName); } -//----------------------------------------------------------------------------- - Sequence< OUString > SAL_CALL SvxGraphCtrlAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException ) { Sequence< OUString > aSNs( 3 ); @@ -594,7 +578,6 @@ Sequence< OUString > SAL_CALL SvxGraphCtrlAccessibleContext::getSupportedService } //===== XTypeProvider ======================================================= - Sequence SAL_CALL SvxGraphCtrlAccessibleContext::getImplementationId( void ) throw( RuntimeException ) { ::SolarMutexGuard aGuard; diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx index da7239296197..66812ff0ac68 100644 --- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx +++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx @@ -1019,7 +1019,6 @@ Any SAL_CALL SvxRectCtlChildAccessibleContext::getMinimumValue() throw( RuntimeE } //===== XServiceInfo ======================================================== - OUString SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationName( void ) throw( RuntimeException ) { return OUString( "com.sun.star.comp.ui.SvxRectCtlChildAccessibleContext" ); @@ -1027,18 +1026,7 @@ OUString SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationName( void sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::supportsService( const OUString& sServiceName ) throw( RuntimeException ) { - // Iterate over all supported service names and return true if on of them - // matches the given name. - ::osl::MutexGuard aGuard( maMutex ); - Sequence< OUString > aSupportedServices ( getSupportedServiceNames() ); - int nLength = aSupportedServices.getLength(); - for( int i = 0 ; i < nLength; ++i ) - { - if( sServiceName == aSupportedServices[ i ] ) - return sal_True; - } - - return sal_False; + return cppu::supportsService(this, sServiceName); } Sequence< OUString > SAL_CALL SvxRectCtlChildAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException ) @@ -1048,7 +1036,6 @@ Sequence< OUString > SAL_CALL SvxRectCtlChildAccessibleContext::getSupportedServ } //===== XTypeProvider ======================================================= - Sequence< sal_Int8 > SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationId( void ) throw( RuntimeException ) { static OImplementationId* pId = 0; diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index 46bca87b1b5b..bfaa79119530 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -42,24 +42,18 @@ #include #include #include +#include using namespace css; using namespace css::uno; -// --------------------------- // - EnhancedCustomShapeEngine - -// --------------------------- - OUString EnhancedCustomShapeEngine_getImplementationName() throw( RuntimeException ) { return OUString( "com.sun.star.drawing.EnhancedCustomShapeEngine" ); } -sal_Bool SAL_CALL EnhancedCustomShapeEngine_supportsService( const OUString& ServiceName ) - throw( RuntimeException ) -{ - return ServiceName == "com.sun.star.drawing.CustomShapeEngine"; -} + Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames() throw( RuntimeException ) { @@ -69,8 +63,6 @@ Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames return aRet; } -// ----------------------------------------------------------------------------- - EnhancedCustomShapeEngine::EnhancedCustomShapeEngine( const Reference< lang::XMultiServiceFactory >& rxMgr ) : mxFact ( rxMgr ), mbForceGroupWithText ( sal_False ) @@ -114,7 +106,6 @@ void SAL_CALL EnhancedCustomShapeEngine::initialize( const Sequence< Any >& aArg } // XServiceInfo --------------------------------------------------------------- - OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName() throw( RuntimeException ) { @@ -123,7 +114,7 @@ OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName() sal_Bool SAL_CALL EnhancedCustomShapeEngine::supportsService( const OUString& rServiceName ) throw( RuntimeException ) { - return EnhancedCustomShapeEngine_supportsService( rServiceName ); + return cppu::supportsService(this, rServiceName); } Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceNames() throw ( RuntimeException ) @@ -132,7 +123,6 @@ Sequence< OUString > SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceName } // XCustomShapeEngine ----------------------------------------------------------- - SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape ) { bool bHasText = pCustoObj->HasText(); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 358328bfc844..939069f13375 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -408,24 +409,16 @@ Sequence SAL_CALL FmXGridControl::getImplementationId( ) throw(Runtim } // XServiceInfo -//------------------------------------------------------------------------------ sal_Bool SAL_CALL FmXGridControl::supportsService(const OUString& ServiceName) throw() { - ::comphelper::StringSequence aSupported = getSupportedServiceNames(); - const OUString * pArray = aSupported.getConstArray(); - for( sal_Int32 i = 0; i < aSupported.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } -//------------------------------------------------------------------------------ OUString SAL_CALL FmXGridControl::getImplementationName() throw() { return OUString("com.sun.star.form.FmXGridControl"); } -//------------------------------------------------------------------------------ ::comphelper::StringSequence SAL_CALL FmXGridControl::getSupportedServiceNames() throw() { Sequence< OUString > aServiceNames(2); diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index dcd2b18aa2eb..f4e5e0002649 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -75,6 +75,7 @@ #include #include #include +#include #include #include #include @@ -674,7 +675,6 @@ Sequence< sal_Int8 > SAL_CALL FormController::getImplementationId() throw( Runti return pId->getImplementationId(); } -//------------------------------------------------------------------------------ Sequence< Type > SAL_CALL FormController::getTypes( ) throw(RuntimeException) { return comphelper::concatSequences( @@ -684,24 +684,16 @@ Sequence< Type > SAL_CALL FormController::getTypes( ) throw(RuntimeException) } // XServiceInfo -//------------------------------------------------------------------------------ sal_Bool SAL_CALL FormController::supportsService(const OUString& ServiceName) throw( RuntimeException ) { - Sequence< OUString> aSNL(getSupportedServiceNames()); - const OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } -//------------------------------------------------------------------------------ OUString SAL_CALL FormController::getImplementationName() throw( RuntimeException ) { return OUString("org.openoffice.comp.svx.FormController"); } -//------------------------------------------------------------------------------ Sequence< OUString> SAL_CALL FormController::getSupportedServiceNames(void) throw( RuntimeException ) { // service names which are supported only, but cannot be used to created an diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index 6131c24ebc56..e3401615d00a 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -277,14 +278,7 @@ void SAL_CALL FontHeightToolBoxControl::release() throw () sal_Bool SAL_CALL FontHeightToolBoxControl::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) { - const uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; + return cppu::supportsService(this, ServiceName); } OUString SAL_CALL FontHeightToolBoxControl::getImplementationName() diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index f2558d9d2b10..e1bac23aad38 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -383,14 +384,7 @@ OUString SAL_CALL FindTextToolbarController::getImplementationName() throw( css: sal_Bool SAL_CALL FindTextToolbarController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ) { - const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; + return cppu::supportsService(this, ServiceName); } css::uno::Sequence< OUString > SAL_CALL FindTextToolbarController::getSupportedServiceNames() throw( css::uno::RuntimeException ) @@ -556,14 +550,7 @@ OUString SAL_CALL UpDownSearchToolboxController::getImplementationName() throw( sal_Bool SAL_CALL UpDownSearchToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ) { - const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; + return cppu::supportsService(this, ServiceName); } css::uno::Sequence< OUString > SAL_CALL UpDownSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) @@ -664,14 +651,7 @@ OUString SAL_CALL MatchCaseToolboxController::getImplementationName() throw( css sal_Bool SAL_CALL MatchCaseToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ) { - const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; + return cppu::supportsService(this, ServiceName); } css::uno::Sequence< OUString > SAL_CALL MatchCaseToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) @@ -783,15 +763,7 @@ OUString SAL_CALL FindAllToolboxController::getImplementationName() throw( css:: sal_Bool SAL_CALL FindAllToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ) { - const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; - + return cppu::supportsService(this, ServiceName); } css::uno::Sequence< OUString > SAL_CALL FindAllToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) @@ -886,15 +858,7 @@ OUString SAL_CALL ExitSearchToolboxController::getImplementationName() throw( cs sal_Bool SAL_CALL ExitSearchToolboxController::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ) { - const css::uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; - + return cppu::supportsService(this, ServiceName); } css::uno::Sequence< OUString > SAL_CALL ExitSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) @@ -1002,10 +966,7 @@ OUString SAL_CALL FindbarDispatcher::getImplementationName() throw( css::uno::Ru sal_Bool SAL_CALL FindbarDispatcher::supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ) { - return ( - ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.comp.svx.FindbarDispatcher")) || - ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.frame.ProtocolHandler")) - ); + return cppu::supportsService(this, ServiceName); } css::uno::Sequence< OUString > SAL_CALL FindbarDispatcher::getSupportedServiceNames() throw( css::uno::RuntimeException ) diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx index 5c8e11f0d8db..cff819f6fb58 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx @@ -28,21 +28,17 @@ #include // header for class OImplementationId +#include #include #include #include #include #include -//............................................................................. namespace textconversiondlgs { -//............................................................................. using namespace ::com::sun::star; -#define SERVICE_IMPLEMENTATION_NAME OUString("com.sun.star.comp.linguistic2.ChineseTranslationDialog") -#define SERVICE_NAME OUString("com.sun.star.linguistic2.ChineseTranslationDialog") - ChineseTranslation_UnoDialog::ChineseTranslation_UnoDialog( const uno::Reference< uno::XComponentContext >& xContext ) : m_xCC( xContext ) , m_xParentWindow( 0 ) @@ -70,9 +66,8 @@ void ChineseTranslation_UnoDialog::impl_DeleteDialog() m_pDialog = 0; } } -//------------------------------------------------------------------------- -// lang::XServiceInfo +// lang::XServiceInfo OUString SAL_CALL ChineseTranslation_UnoDialog::getImplementationName() throw( uno::RuntimeException ) { return getImplementationName_Static(); @@ -80,19 +75,12 @@ OUString SAL_CALL ChineseTranslation_UnoDialog::getImplementationName() throw( u OUString ChineseTranslation_UnoDialog::getImplementationName_Static() { - return SERVICE_IMPLEMENTATION_NAME; + return OUString("com.sun.star.comp.linguistic2.ChineseTranslationDialog"); } sal_Bool SAL_CALL ChineseTranslation_UnoDialog::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException ) { - uno::Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString* pArray = aSNL.getArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - { - if( pArray[ i ] == ServiceName ) - return sal_True; - } - return sal_False; + return cppu::supportsService(this, ServiceName); } uno::Sequence< OUString > SAL_CALL ChineseTranslation_UnoDialog::getSupportedServiceNames() throw( uno::RuntimeException ) @@ -103,13 +91,11 @@ uno::Sequence< OUString > SAL_CALL ChineseTranslation_UnoDialog::getSupportedSer uno::Sequence< OUString > ChineseTranslation_UnoDialog::getSupportedServiceNames_Static() { uno::Sequence< OUString > aSNS( 1 ); - aSNS.getArray()[ 0 ] = SERVICE_NAME; + aSNS.getArray()[ 0 ] = OUString("com.sun.star.linguistic2.ChineseTranslationDialog"); return aSNS; } -//------------------------------------------------------------------------- // ui::dialogs::XExecutableDialog - void SAL_CALL ChineseTranslation_UnoDialog::setTitle( const OUString& ) throw(uno::RuntimeException) { //not implemented - fell free to do so, if you do need this diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 21dcfd901236..21a55605d270 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -1229,14 +1230,7 @@ OUString SAL_CALL GraphicExporter::getImplementationName( ) sal_Bool SAL_CALL GraphicExporter::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - Sequence< OUString > aSeq( GraphicExporter_getSupportedServiceNames() ); - sal_Int32 nArgs = aSeq.getLength(); - const OUString* pService = aSeq.getConstArray(); - while( nArgs-- ) - if( *pService++ == ServiceName ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } Sequence< OUString > SAL_CALL GraphicExporter::getSupportedServiceNames( ) diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx index c902f341359b..b696c29665cd 100644 --- a/svx/source/unodraw/UnoNameItemTable.cxx +++ b/svx/source/unodraw/UnoNameItemTable.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "UnoNameItemTable.hxx" @@ -79,14 +80,7 @@ void SvxUnoNameItemTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw( sal_Bool SAL_CALL SvxUnoNameItemTable::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) { - uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } void SAL_CALL SvxUnoNameItemTable::ImplInsertByName( const OUString& aName, const uno::Any& aElement ) diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx index 7c4ac26097c4..6c74a99386fc 100644 --- a/svx/source/unodraw/XPropertyTable.cxx +++ b/svx/source/unodraw/XPropertyTable.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include "svx/unoapi.hxx" @@ -96,17 +97,7 @@ XPropertyEntry* SvxUnoXPropertyTable::get( long index ) const sal_Bool SAL_CALL SvxUnoXPropertyTable::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException) { - const uno::Sequence< OUString > aServices( getSupportedServiceNames() ); - const OUString* pServices = aServices.getConstArray(); - const sal_Int32 nCount = aServices.getLength(); - sal_Int32 i; - for( i = 0; i < nCount; i++ ) - { - if( *pServices++ == ServiceName ) - return sal_True; - } - - return sal_False; + return cppu::supportsService(this, ServiceName); } // XNameContainer diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx index e1da634b103a..ce51832b621b 100644 --- a/svx/source/unodraw/recoveryui.cxx +++ b/svx/source/unodraw/recoveryui.cxx @@ -28,17 +28,13 @@ #include #include #include +#include #include #include #include - -#define IMPLEMENTATIONNAME_RECOVERYUI OUString("com.sun.star.comp.svx.RecoveryUI") -#define SERVICENAME_RECOVERYUI OUString("com.sun.star.dialog.RecoveryUI") - - namespace svx { @@ -47,7 +43,6 @@ namespace svxdr = ::svx::DocRecovery; using namespace ::rtl; using namespace ::osl; -//=============================================== RecoveryUI::RecoveryUI(const css::uno::Reference< css::uno::XComponentContext >& xContext) : m_xContext (xContext ) , m_pParentWindow(0 ) @@ -55,42 +50,28 @@ RecoveryUI::RecoveryUI(const css::uno::Reference< css::uno::XComponentContext >& { } -//=============================================== RecoveryUI::~RecoveryUI() { } -//=============================================== OUString SAL_CALL RecoveryUI::getImplementationName() throw(css::uno::RuntimeException) { return RecoveryUI::st_getImplementationName(); } -//=============================================== sal_Bool SAL_CALL RecoveryUI::supportsService(const OUString& sServiceName) throw(css::uno::RuntimeException) { - const css::uno::Sequence< OUString > lServices = RecoveryUI::st_getSupportedServiceNames(); - sal_Int32 c = lServices.getLength(); - sal_Int32 i = 0; - for (i=0; i SAL_CALL RecoveryUI::getSupportedServiceNames() throw(css::uno::RuntimeException) { return RecoveryUI::st_getSupportedServiceNames(); } -//=============================================== css::uno::Any SAL_CALL RecoveryUI::dispatchWithReturnValue(const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& ) throw(css::uno::RuntimeException) @@ -151,28 +132,24 @@ void SAL_CALL RecoveryUI::removeStatusListener(const css::uno::Reference< css::f OSL_FAIL("RecoveryUI::removeStatusListener()\nNot implemented yet!"); } -//=============================================== OUString RecoveryUI::st_getImplementationName() { - return OUString(IMPLEMENTATIONNAME_RECOVERYUI); + return OUString("com.sun.star.comp.svx.RecoveryUI"); } -//=============================================== css::uno::Sequence< OUString > RecoveryUI::st_getSupportedServiceNames() { - css::uno::Sequence< OUString > lServiceNames(1); lServiceNames.getArray() [0] = SERVICENAME_RECOVERYUI; + css::uno::Sequence< OUString > lServiceNames(1); + lServiceNames.getArray() [0] = OUString("com.sun.star.dialog.RecoveryUI"); return lServiceNames; } -//=============================================== css::uno::Reference< css::uno::XInterface > SAL_CALL RecoveryUI::st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { RecoveryUI* pNew = new RecoveryUI(comphelper::getComponentContext(xSMGR)); return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XServiceInfo* >(pNew)); } -//=============================================== - static OUString GetCrashConfigDir() { diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index 6ee8b68b93bf..2c7fef5c6500 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -708,7 +708,7 @@ OUString SAL_CALL SvxUnoDrawPagesAccess::getImplementationName( ) throw(uno::Ru sal_Bool SAL_CALL SvxUnoDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) { - return ServiceName == pSvxUnoDrawPagesAccessService; + return cppu::supportsService(this, ServiceName); } uno::Sequence< OUString > SAL_CALL SvxUnoDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException) diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx index 5673056ba446..76c3e1b5a334 100644 --- a/svx/source/unodraw/unomtabl.cxx +++ b/svx/source/unodraw/unomtabl.cxx @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -131,14 +132,7 @@ void SvxUnoMarkerTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw() sal_Bool SAL_CALL SvxUnoMarkerTable::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) { - uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } OUString SAL_CALL SvxUnoMarkerTable::getImplementationName() throw( uno::RuntimeException ) diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx index 48dd8b4a36ac..8686e0a55f1e 100644 --- a/svx/source/unodraw/unopool.cxx +++ b/svx/source/unodraw/unopool.cxx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include "svx/unopool.hxx" @@ -393,17 +394,9 @@ uno::Sequence< sal_Int8 > SAL_CALL SvxUnoDrawPool::getImplementationId() } // XServiceInfo - sal_Bool SAL_CALL SvxUnoDrawPool::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) { - uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } OUString SAL_CALL SvxUnoDrawPool::getImplementationName() throw( uno::RuntimeException ) diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index f5f14a43e0f0..e580014b9743 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -3793,21 +3794,11 @@ uno::Sequence< OUString > SAL_CALL SvxShape::_getSupportedServiceNames() return aSeq; } -//---------------------------------------------------------------------- sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException ) { - Sequence< OUString > SupportedServices( getSupportedServiceNames() ); - const OUString * pArray = SupportedServices.getConstArray(); - const sal_Int32 nCount = SupportedServices.getLength(); - sal_Int32 i; - for( i = 0; i < nCount; i++ ) - if( *pArray++ == ServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } -//---------------------------------------------------------------------- - // XGluePointsSupplier uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints() throw(uno::RuntimeException) diff --git a/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx index 3eeba97be520..620ee9fcfdd6 100644 --- a/svx/source/unogallery/unogalitem.cxx +++ b/svx/source/unogallery/unogalitem.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include "galobj.hxx" #include @@ -143,39 +144,24 @@ uno::Sequence< OUString > GalleryItem::getSupportedServiceNames_Static() return aSeq; } -// ------------------------------------------------------------------------------ - OUString SAL_CALL GalleryItem::getImplementationName() throw( uno::RuntimeException ) { return getImplementationName_Static(); } -// ------------------------------------------------------------------------------ - sal_Bool SAL_CALL GalleryItem::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException ) { - uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString* pArray = aSNL.getConstArray(); - - for( int i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; + return cppu::supportsService(this, ServiceName); } -// ------------------------------------------------------------------------------ - uno::Sequence< OUString > SAL_CALL GalleryItem::getSupportedServiceNames() throw( uno::RuntimeException ) { return getSupportedServiceNames_Static(); } -// ------------------------------------------------------------------------------ - uno::Sequence< uno::Type > SAL_CALL GalleryItem::getTypes() throw(uno::RuntimeException) { diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 42c9c213f704..b26c811b7e15 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -1017,14 +1018,13 @@ OUString SAL_CALL SvXMLGraphicImportExportHelper::getImplementationName() return SvXMLGraphicImportHelper_getImplementationName(); return SvXMLGraphicExportHelper_getImplementationName(); } + ::sal_Bool SAL_CALL SvXMLGraphicImportExportHelper::supportsService( const OUString& ServiceName ) throw (uno::RuntimeException) { - Sequence< OUString > aServiceNames( getSupportedServiceNames()); - const OUString * pBegin = aServiceNames.getConstArray(); - const OUString * pEnd = pBegin + aServiceNames.getLength(); - return (::std::find( pBegin, pEnd, ServiceName ) != pEnd); + return cppu::supportsService(this, ServiceName); } + Sequence< OUString > SAL_CALL SvXMLGraphicImportExportHelper::getSupportedServiceNames() throw (uno::RuntimeException) { -- cgit