[Libreoffice-commits] core.git: chart2/source chart2/workbench

Alexandre Vicenzi vicenzi.alexandre at gmail.com
Sat Jan 25 06:43:58 PST 2014


 chart2/source/tools/NameContainer.cxx   |   10 ++--------
 chart2/source/view/main/DummyXShape.cxx |   10 ++--------
 chart2/workbench/addin/sampleaddin.cxx  |   12 ++----------
 3 files changed, 6 insertions(+), 26 deletions(-)

New commits:
commit 74c876e615fe575657d0a083f5a3781d4020f0c4
Author: Alexandre Vicenzi <vicenzi.alexandre at gmail.com>
Date:   Sat Jan 25 10:06:29 2014 -0200

    fdo#54938 Convert chart2 to cppu::supportsService
    
    Change-Id: I26e993a6b0dfc54637651b1a093d896faf5b42d3
    Reviewed-on: https://gerrit.libreoffice.org/7644
    Tested-by: LibreOffice gerrit bot <gerrit at libreoffice.org>
    Reviewed-by: Marcos Souza <marcos.souza.org at gmail.com>
    Tested-by: Marcos Souza <marcos.souza.org at gmail.com>

diff --git a/chart2/source/tools/NameContainer.cxx b/chart2/source/tools/NameContainer.cxx
index 0a49fb2..c7b7507 100644
--- a/chart2/source/tools/NameContainer.cxx
+++ b/chart2/source/tools/NameContainer.cxx
@@ -20,6 +20,7 @@
 #include "NameContainer.hxx"
 
 #include <com/sun/star/uno/Any.hxx>
+ #include <cppuhelper/supportsservice.hxx>
 
 using namespace ::com::sun::star;
 using ::com::sun::star::uno::Sequence;
@@ -66,14 +67,7 @@ OUString SAL_CALL NameContainer::getImplementationName()
 sal_Bool SAL_CALL NameContainer::supportsService( const OUString& ServiceName )
     throw( ::com::sun::star::uno::RuntimeException )
 {
-    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);
 }
 
 Sequence< OUString > SAL_CALL NameContainer::getSupportedServiceNames()
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index b1eb93f..4d8511f 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -13,6 +13,7 @@
 
 #include <vcl/window.hxx>
 #include <tools/gen.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <algorithm>
 
@@ -184,14 +185,7 @@ uno::Sequence< OUString > DummyXShape::getSupportedServiceNames()
 sal_Bool DummyXShape::supportsService( const OUString& rServiceName )
     throw(uno::RuntimeException)
 {
-    uno::Sequence< OUString > aSupportedServices = listSupportedServices();
-    for(sal_Int32 i = 0; i < aSupportedServices.getLength(); ++i)
-    {
-        if(aSupportedServices[i] == rServiceName)
-            return true;
-    }
-
-    return false;
+    return cppu::supportsService(this, ServiceName);
 }
 
 uno::Reference< uno::XInterface > DummyXShape::getParent()
diff --git a/chart2/workbench/addin/sampleaddin.cxx b/chart2/workbench/addin/sampleaddin.cxx
index 7fe53ae..1c964f7 100644
--- a/chart2/workbench/addin/sampleaddin.cxx
+++ b/chart2/workbench/addin/sampleaddin.cxx
@@ -18,6 +18,7 @@
  */
 #include "sampleaddin.hxx"
 
+#include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/factory.hxx>
 #include <osl/diagnose.h>
 
@@ -633,16 +634,7 @@ OUString SAL_CALL SampleAddIn::getImplementationName() throw( uno::RuntimeExcept
 sal_Bool SAL_CALL SampleAddIn::supportsService( const OUString& ServiceName )
     throw( uno::RuntimeException )
 {
-    uno::Sequence< OUString > aServiceSeq = getSupportedServiceNames_Static();
-
-    sal_Int32 nLength = aServiceSeq.getLength();
-    for( sal_Int32 i=0; i < nLength; i++ )
-    {
-        if( ServiceName.equals( aServiceSeq[ i ] ))
-            return sal_True;
-    }
-
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 uno::Sequence< OUString > SAL_CALL SampleAddIn::getSupportedServiceNames()


More information about the Libreoffice-commits mailing list