From cccc6c4ebcc508576d9cf609a649d4d3d76d61eb Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Thu, 5 Dec 2013 19:18:01 -0200 Subject: [PATCH] fdo#54938: Convert sd to use cppu::supportsService Change-Id: I1aaecbc9f7b5ca0ca2009caf38013054f84cbecc Signed-off-by: Stephan Bergmann --- sd/source/core/stlpool.cxx | 17 ++--------- sd/source/filter/html/HtmlOptionsDialog.cxx | 13 ++------- .../AccessibleSlideSorterObject.cxx | 29 ++----------------- .../AccessibleSlideSorterView.cxx | 28 ++---------------- sd/source/ui/unoidl/DrawController.cxx | 20 ++----------- sd/source/ui/unoidl/randomnode.cxx | 13 ++++----- sd/source/ui/unoidl/sddetect.cxx | 12 ++------ sd/source/ui/unoidl/unomodel.cxx | 16 ++-------- sd/source/ui/unoidl/unoobj.cxx | 3 +- 9 files changed, 26 insertions(+), 125 deletions(-) diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 5d90facdce2c..2401f06fccbd 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -1117,36 +1118,24 @@ void SdStyleSheetPool::throwIfDisposed() throw(::com::sun::star::uno::RuntimeExc throw DisposedException(); } -// -------------------------------------------------------------------- // XServiceInfo -// -------------------------------------------------------------------- - OUString SAL_CALL SdStyleSheetPool::getImplementationName() throw(RuntimeException) { return OUString( "SdStyleSheetPool" ); } -// -------------------------------------------------------------------- - -static const sal_Char* gpServiceName = "com.sun.star.style.StyleFamilies"; - sal_Bool SAL_CALL SdStyleSheetPool::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - return ServiceName.equalsAscii( gpServiceName ); + return cppu::supportsService(this, ServiceName); } -// -------------------------------------------------------------------- - Sequence< OUString > SAL_CALL SdStyleSheetPool::getSupportedServiceNames() throw(RuntimeException) { - OUString aStr( OUString::createFromAscii( gpServiceName ) ); + OUString aStr("com.sun.star.style.StyleFamilies"); return Sequence< OUString >( &aStr, 1 ); } -// -------------------------------------------------------------------- // XNameAccess -// -------------------------------------------------------------------- - Any SAL_CALL SdStyleSheetPool::getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException) { throwIfDisposed(); diff --git a/sd/source/filter/html/HtmlOptionsDialog.cxx b/sd/source/filter/html/HtmlOptionsDialog.cxx index 25c94ea616dc..28d1bf3375f9 100644 --- a/sd/source/filter/html/HtmlOptionsDialog.cxx +++ b/sd/source/filter/html/HtmlOptionsDialog.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include #include #include @@ -32,6 +31,7 @@ #include #include #include +#include #include using namespace com::sun::star::uno; @@ -94,10 +94,7 @@ public: }; -// ------------------------- // - SdHtmlOptionsDialog - -// ------------------------- - Reference< XInterface > SAL_CALL SdHtmlOptionsDialog_CreateInstance( SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & ) @@ -111,12 +108,6 @@ OUString SdHtmlOptionsDialog_getImplementationName() return OUString( "com.sun.star.comp.draw.SdHtmlOptionsDialog" ); } -sal_Bool SAL_CALL SdHtmlOptionsDialog_supportsService( const OUString& ServiceName ) - throw( RuntimeException ) -{ - return ServiceName.equals("com.sun.star.ui.dialog.FilterOptionsDialog"); -} - Sequence< OUString > SAL_CALL SdHtmlOptionsDialog_getSupportedServiceNames() throw( RuntimeException ) { @@ -167,7 +158,7 @@ OUString SAL_CALL SdHtmlOptionsDialog::getImplementationName() sal_Bool SAL_CALL SdHtmlOptionsDialog::supportsService( const OUString& rServiceName ) throw( RuntimeException ) { - return SdHtmlOptionsDialog_supportsService( rServiceName ); + return cppu::supportsService(this, rServiceName); } Sequence< OUString > SAL_CALL SdHtmlOptionsDialog::getSupportedServiceNames() throw ( RuntimeException ) diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx index f15771189a63..7771dd9dc7ec 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "sdpage.hxx" @@ -485,12 +486,7 @@ sal_Int32 SAL_CALL AccessibleSlideSorterObject::getBackground (void) return static_cast(nColor); } - - - - //===== XServiceInfo ======================================================== - OUString SAL_CALL AccessibleSlideSorterObject::getImplementationName (void) throw (::com::sun::star::uno::RuntimeException) @@ -498,28 +494,12 @@ OUString SAL_CALL return OUString("AccessibleSlideSorterObject"); } - - - -sal_Bool SAL_CALL - AccessibleSlideSorterObject::supportsService (const OUString& sServiceName) +sal_Bool SAL_CALL AccessibleSlideSorterObject::supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException) { - ThrowIfDisposed (); - - // Iterate over all supported service names and return true if on of them - // matches the given name. - uno::Sequence< OUString> aSupportedServices ( - getSupportedServiceNames ()); - for (int i=0; i SAL_CALL AccessibleSlideSorterObject::getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException) @@ -533,9 +513,6 @@ uno::Sequence< OUString> SAL_CALL return uno::Sequence (sServiceNames, 2); } - - - void AccessibleSlideSorterObject::ThrowIfDisposed (void) throw (lang::DisposedException) { diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index f9ba34e2d138..30f7fdeba517 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -711,11 +712,7 @@ void SAL_CALL AccessibleSlideSorterView::deselectAccessibleChild (sal_Int32 nChi throw lang::IndexOutOfBoundsException(); } - - - //===== XServiceInfo ======================================================== - OUString SAL_CALL AccessibleSlideSorterView::getImplementationName (void) throw (::com::sun::star::uno::RuntimeException) @@ -723,28 +720,12 @@ OUString SAL_CALL return OUString("AccessibleSlideSorterView"); } - - - -sal_Bool SAL_CALL - AccessibleSlideSorterView::supportsService (const OUString& sServiceName) +sal_Bool SAL_CALL AccessibleSlideSorterView::supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException) { - ThrowIfDisposed (); - - // Iterate over all supported service names and return true if on of them - // matches the given name. - uno::Sequence< OUString> aSupportedServices ( - getSupportedServiceNames ()); - for (int i=0; i SAL_CALL AccessibleSlideSorterView::getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException) @@ -759,9 +740,6 @@ uno::Sequence< OUString> SAL_CALL return uno::Sequence (sServiceNames, 3); } - - - void AccessibleSlideSorterView::ThrowIfDisposed (void) throw (lang::DisposedException) { diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index ff5bad215461..2efc800eafcb 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -222,9 +223,7 @@ void SAL_CALL DrawController::removeEventListener ( return SfxBaseController::suspend( Suspend ); } - // XServiceInfo - OUString SAL_CALL DrawController::getImplementationName( ) throw(RuntimeException) { // Do not throw an excepetion at the moment. This leads to a crash @@ -233,23 +232,14 @@ OUString SAL_CALL DrawController::getImplementationName( ) throw(RuntimeExcepti return OUString("DrawController") ; } - - static OUString ssServiceName( "com.sun.star.drawing.DrawingDocumentDrawView"); -sal_Bool SAL_CALL DrawController::supportsService ( - const OUString& rsServiceName) +sal_Bool SAL_CALL DrawController::supportsService (const OUString& rsServiceName) throw(RuntimeException) { - // Do not throw an exception at the moment. This leads to a crash - // under Solaris on relead. See issue i70929 for details. - // ThrowIfDisposed(); - return rsServiceName.equals(ssServiceName); + return cppu::supportsService(this, rsServiceName); } - - - Sequence SAL_CALL DrawController::getSupportedServiceNames (void) throw(RuntimeException) { @@ -260,11 +250,7 @@ Sequence SAL_CALL DrawController::getSupportedServiceNames (void) return aSupportedServices; } - - - //------ XSelectionSupplier -------------------------------------------- - sal_Bool SAL_CALL DrawController::select (const Any& aSelection) throw(lang::IllegalArgumentException, RuntimeException) { diff --git a/sd/source/ui/unoidl/randomnode.cxx b/sd/source/ui/unoidl/randomnode.cxx index a18fd1c22619..45221ce0fc48 100644 --- a/sd/source/ui/unoidl/randomnode.cxx +++ b/sd/source/ui/unoidl/randomnode.cxx @@ -31,6 +31,7 @@ #include #include +#include #include #include "CustomAnimationPreset.hxx" @@ -153,11 +154,6 @@ private: // -------------------------------------------------------------------- -static const sal_Char* pSN1 = "com.sun.star.animations.ParallelTimeContainer"; -static const sal_Char* pSN2 = "com.sun.star.comp.sd.RandomAnimationNode"; - -// -------------------------------------------------------------------- - SD_DLLPUBLIC Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetClass ) { Reference< XInterface > xInt( static_cast( new RandomAnimationNode( nPresetClass ) ) ); @@ -183,8 +179,9 @@ OUString RandomNode__getImplementationName() throw( RuntimeException ) Sequence< OUString > SAL_CALL RandomNode_getSupportedServiceNames() throw( RuntimeException ) { - static const OUString aSN2( OUString::createFromAscii( pSN2 ) ); - Sequence< OUString > aSeq( &aSN2, 1 ); + Sequence< OUString > aSeq( 2 ); + aSeq[0] = "com.sun.star.animations.ParallelTimeContainer"; + aSeq[1] = "com.sun.star.comp.sd.RandomAnimationNode"; return aSeq; } @@ -671,7 +668,7 @@ OUString RandomAnimationNode::getImplementationName() throw() // XServiceInfo sal_Bool RandomAnimationNode::supportsService(const OUString& ServiceName) throw() { - return ServiceName.equalsAscii( pSN1 ) || ServiceName.equalsAscii( pSN2 ); + return cppu::supportsService(this, ServiceName); } // XServiceInfo diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx index 0fddd1be6459..d07c2007b4fe 100644 --- a/sd/source/ui/unoidl/sddetect.cxx +++ b/sd/source/ui/unoidl/sddetect.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -511,16 +512,7 @@ OUString SAL_CALL SdFilterDetect::getImplementationName() throw( RuntimeExceptio /* XServiceInfo */ sal_Bool SAL_CALL SdFilterDetect::supportsService( const OUString& sServiceName ) throw( RuntimeException ) { - Sequence< OUString > seqServiceNames = getSupportedServiceNames(); - const OUString* pArray = seqServiceNames.getConstArray(); - for ( sal_Int32 nCounter=0; nCounter SAL_CALL SdXImpressDocument::getSupportedServiceNames() throw(uno::RuntimeException) @@ -2569,7 +2559,7 @@ OUString SAL_CALL SdDrawPagesAccess::getImplementationName( ) throw(uno::Runtim sal_Bool SAL_CALL SdDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) { - return ServiceName == pSdDrawPagesAccessService; + return cppu::supportsService(this, ServiceName); } uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException) @@ -2837,7 +2827,7 @@ OUString SAL_CALL SdMasterPagesAccess::getImplementationName( ) throw(uno::Runt sal_Bool SAL_CALL SdMasterPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) { - return ServiceName == pSdMasterPagesAccessService; + return cppu::supportsService(this, ServiceName); } uno::Sequence< OUString > SAL_CALL SdMasterPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException) diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 49c61762bd2b..e864e1906cfa 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -1699,7 +1700,7 @@ OUString SAL_CALL SdUnoEventsAccess::getImplementationName( ) sal_Bool SAL_CALL SdUnoEventsAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) { - return ServiceName == maStrServiceName; + return cppu::supportsService(this, ServiceName); } uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getSupportedServiceNames( )