[Libreoffice-commits] core.git: sd/source

Marcos Paulo de Souza marcos.souza.org at gmail.com
Mon Dec 9 08:09:09 PST 2013


 sd/source/core/stlpool.cxx                                 |   17 +------
 sd/source/filter/html/HtmlOptionsDialog.cxx                |   13 -----
 sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx |   29 +------------
 sd/source/ui/accessibility/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(-)

New commits:
commit cccc6c4ebcc508576d9cf609a649d4d3d76d61eb
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Thu Dec 5 19:18:01 2013 -0200

    fdo#54938: Convert sd to use cppu::supportsService
    
    Change-Id: I1aaecbc9f7b5ca0ca2009caf38013054f84cbecc
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 5d90fac..2401f06 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -19,6 +19,7 @@
 
 
 #include <com/sun/star/lang/DisposedException.hpp>
+#include <cppuhelper/supportsservice.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/fhgtitem.hxx>
 #include <editeng/colritem.hxx>
@@ -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 25c94ea..28d1bf3 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 <osl/file.hxx>
 #include <osl/module.hxx>
 #include <com/sun/star/frame/XModel.hpp>
@@ -32,6 +31,7 @@
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
 #include <com/sun/star/document/XExporter.hpp>
 #include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <vcl/svapp.hxx>
 
 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 f157711..7771dd9 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <comphelper/accessibleeventnotifier.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 
 #include "sdpage.hxx"
@@ -485,12 +486,7 @@ sal_Int32 SAL_CALL AccessibleSlideSorterObject::getBackground (void)
     return static_cast<sal_Int32>(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<aSupportedServices.getLength(); i++)
-        if (sServiceName == aSupportedServices[i])
-            return sal_True;
-    return sal_False;
+    return cppu::supportsService(this, sServiceName);
 }
 
-
-
-
 uno::Sequence< OUString> SAL_CALL
        AccessibleSlideSorterObject::getSupportedServiceNames (void)
     throw (::com::sun::star::uno::RuntimeException)
@@ -533,9 +513,6 @@ uno::Sequence< OUString> SAL_CALL
     return uno::Sequence<OUString> (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 f9ba34e..30f7fde 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -41,6 +41,7 @@
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <comphelper/accessibleeventnotifier.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 #include <rtl/ref.hxx>
 #include <vcl/svapp.hxx>
@@ -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<aSupportedServices.getLength(); i++)
-        if (sServiceName == aSupportedServices[i])
-            return sal_True;
-    return sal_False;
+    return cppu::supportsService(this, sServiceName);
 }
 
-
-
-
 uno::Sequence< OUString> SAL_CALL
        AccessibleSlideSorterView::getSupportedServiceNames (void)
     throw (::com::sun::star::uno::RuntimeException)
@@ -759,9 +740,6 @@ uno::Sequence< OUString> SAL_CALL
     return uno::Sequence<OUString> (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 ff5bad2..2efc800 100644
--- a/sd/source/ui/unoidl/DrawController.cxx
+++ b/sd/source/ui/unoidl/DrawController.cxx
@@ -34,6 +34,7 @@
 #include <comphelper/servicehelper.hxx>
 #include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/bootstrap.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/drawing/framework/ConfigurationController.hpp>
@@ -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<OUString> SAL_CALL DrawController::getSupportedServiceNames (void)
     throw(RuntimeException)
 {
@@ -260,11 +250,7 @@ Sequence<OUString> 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 a18fd1c..45221ce 100644
--- a/sd/source/ui/unoidl/randomnode.cxx
+++ b/sd/source/ui/unoidl/randomnode.cxx
@@ -31,6 +31,7 @@
 #include <comphelper/processfactory.hxx>
 
 #include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <osl/mutex.hxx>
 #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<XWeak*>( 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 0fddd1b..d07c200 100644
--- a/sd/source/ui/unoidl/sddetect.cxx
+++ b/sd/source/ui/unoidl/sddetect.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/awt/XWindow.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <comphelper/processfactory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/task/XInteractionHandler.hpp>
@@ -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<seqServiceNames.getLength(); nCounter++ )
-    {
-        if ( pArray[nCounter] == sServiceName )
-        {
-            return sal_True ;
-        }
-    }
-    return sal_False ;
+    return cppu::supportsService(this, sServiceName);
 }
 
 /* XServiceInfo */
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 7db3425..3e1b957 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1173,17 +1173,7 @@ OUString SAL_CALL SdXImpressDocument::getImplementationName()
 sal_Bool SAL_CALL SdXImpressDocument::supportsService( const OUString& ServiceName )
     throw(uno::RuntimeException)
 {
-    ::SolarMutexGuard aGuard;
-
-    if ( ServiceName == "com.sun.star.document.OfficeDocument"
-      || ServiceName == "com.sun.star.drawing.GenericDrawingDocument"
-      || ServiceName == "com.sun.star.drawing.DrawingDocumentFactory" )
-    {
-        return sal_True;
-    }
-
-    return ( ( mbImpressDoc && ServiceName == "com.sun.star.presentation.PresentationDocument" )
-         || ( !mbImpressDoc && ServiceName == "com.sun.star.drawing.DrawingDocument" ) );
+    return cppu::supportsService(this, ServiceName);
 }
 
 uno::Sequence< OUString > 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 49c6176..e864e19 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -39,6 +39,7 @@
 #include <sfx2/bindings.hxx>
 #include <sfx2/sfxsids.hrc>
 #include <comphelper/extract.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <svx/unoprov.hxx>
 #include <svx/unoshape.hxx>
 #include <svx/svditer.hxx>
@@ -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(  )


More information about the Libreoffice-commits mailing list