[Libreoffice-commits] core.git: bridges/test oox/source sc/inc svtools/source vcl/osx xmlscript/source

Alexandre Vicenzi vicenzi.alexandre at gmail.com
Thu Feb 6 07:48:26 PST 2014


 bridges/test/testcomp.cxx                  |   14 +++-----------
 oox/source/shape/ShapeContextHandler.cxx   |   17 +++++------------
 oox/source/shape/ShapeContextHandler.hxx   |    7 ++++---
 sc/inc/miscuno.hxx                         |    3 ++-
 svtools/source/uno/unoimap.cxx             |   10 +---------
 vcl/osx/clipboard.cxx                      |    4 ++--
 xmlscript/source/xml_helper/xml_impctx.cxx |   22 ++++++++--------------
 7 files changed, 25 insertions(+), 52 deletions(-)

New commits:
commit f139c10fd357c1c07f857a1d277f39d9cbc39d1f
Author: Alexandre Vicenzi <vicenzi.alexandre at gmail.com>
Date:   Wed Feb 5 23:57:38 2014 -0200

    fdo#54938 Convert oox, sc, vcl, svtools... to cppu::supportsService
    
    Change-Id: I6268bc57417d53b9810c81071fbcd604e2a19507
    Reviewed-on: https://gerrit.libreoffice.org/7886
    Tested-by: LibreOffice gerrit bot <gerrit at libreoffice.org>
    Reviewed-by: Marcos Souza <marcos.souza.org at gmail.com>

diff --git a/bridges/test/testcomp.cxx b/bridges/test/testcomp.cxx
index c588663..ebf0971 100644
--- a/bridges/test/testcomp.cxx
+++ b/bridges/test/testcomp.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/test/performance/XPerformanceTest.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <cppuhelper/weak.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 using namespace ::test;
 using namespace ::com::sun::star::uno;
@@ -252,10 +253,10 @@ OUString ServiceImpl::getImplementationName()
     return OUString( );
 }
 
-sal_Bool ServiceImpl::supportsService( const OUString & /* rServiceName */)
+sal_Bool ServiceImpl::supportsService( const OUString & rServiceName )
     throw (RuntimeException)
 {
-    return sal_False;
+    return cppu::supportsService(this, rServiceName);
 }
 
 Sequence< OUString > ServiceImpl::getSupportedServiceNames()
@@ -610,7 +611,6 @@ void testAllTypes( const Reference < XCallMe > & rRCallMe )
         OSL_ASSERT( types.Interface == retTypes.Interface );
         OSL_ASSERT( types.Any == retTypes.Any );
     }
-
 }
 
 void testRemote( const Reference< XInterface > &rRemote )
@@ -636,9 +636,7 @@ void testRemote( const Reference< XInterface > &rRemote )
     printf( "Testing exception remote ...\n" );
     testException( rRCallMe );
 
-      //--------------------
       // Test attributes
-      //----------------------
        OUString ow( "dum didel dum dideldei" );
        rLCallMe->setsAttribute( ow );
        OSL_ASSERT( rLCallMe->getsAttribute() == ow );
@@ -646,15 +644,11 @@ void testRemote( const Reference< XInterface > &rRemote )
          rRCallMe->setsAttribute( ow );
          OSL_ASSERT( rRCallMe->getsAttribute() == ow );
 
-    //-------------------
     // Performance test
-    //-------------------
     testPerformance( rRCallMe , rLCallMe );
      testOnewayPerformanceOnTwoInterfaces( rRFact->createCallMe(), rRCallMe );
 
-     //----------------
      // Test sequence
-     //----------------
        testSequenceOfCalls( rRCallMe );
 
 
@@ -704,9 +698,7 @@ void testRemote( const Reference< XInterface > &rRemote )
      // test empty references
      rRTest->setIn( Reference < XCallMe > () );
 
-       //--------------------------------
        // test thread deadlocking
-       //--------------------------------
       rLCallMe->callAgain( rRCallMe, 20 );
 
 }
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index fb24aa3..34ddd3d 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -28,6 +28,7 @@
 #include "oox/vml/vmlshape.hxx"
 #include "oox/drawingml/themefragmenthandler.hxx"
 #include <boost/scoped_ptr.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 namespace oox { namespace shape {
 
@@ -547,8 +548,7 @@ OUString SAL_CALL ShapeContextHandler::getRelationFragmentPath()
     return msRelationFragmentPath;
 }
 
-void SAL_CALL ShapeContextHandler::setRelationFragmentPath
-(const OUString & the_value)
+void SAL_CALL ShapeContextHandler::setRelationFragmentPath(const OUString & the_value)
     throw (uno::RuntimeException)
 {
     msRelationFragmentPath = the_value;
@@ -562,8 +562,6 @@ void SAL_CALL ShapeContextHandler::setRelationFragmentPath
 void SAL_CALL ShapeContextHandler::setStartToken( ::sal_Int32 _starttoken ) throw (::com::sun::star::uno::RuntimeException)
 {
     mnStartToken = _starttoken;
-
-
 }
 
 awt::Point SAL_CALL ShapeContextHandler::getPosition() throw (uno::RuntimeException)
@@ -588,15 +586,10 @@ uno::Sequence< OUString > ShapeContextHandler::getSupportedServiceNames()
     return ShapeContextHandler_getSupportedServiceNames();
 }
 
-::sal_Bool SAL_CALL ShapeContextHandler::supportsService
-(const OUString & ServiceName) throw (css::uno::RuntimeException)
+::sal_Bool SAL_CALL ShapeContextHandler::supportsService(const OUString & ServiceName)
+    throw (css::uno::RuntimeException)
 {
-    uno::Sequence< OUString > aSeq = getSupportedServiceNames();
-
-    if (aSeq[0].equals(ServiceName))
-        return sal_True;
-
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 }}
diff --git a/oox/source/shape/ShapeContextHandler.hxx b/oox/source/shape/ShapeContextHandler.hxx
index bf27e16..d6083dc 100644
--- a/oox/source/shape/ShapeContextHandler.hxx
+++ b/oox/source/shape/ShapeContextHandler.hxx
@@ -21,7 +21,7 @@
 
 #include <boost/shared_ptr.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 "oox/drawingml/graphicshapecontext.hxx"
 #include "oox/drawingml/shape.hxx"
@@ -29,6 +29,7 @@
 #include "oox/core/fragmenthandler2.hxx"
 #include "oox/core/xmlfilterbase.hxx"
 #include "ShapeFilterBase.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
 
 namespace oox { namespace shape {
 
@@ -45,8 +46,8 @@ public:
 };
 
 class ShapeContextHandler:
-    public ::cppu::WeakImplHelper1<
-        css::xml::sax::XFastShapeContextHandler>
+    public ::cppu::WeakImplHelper2< css::xml::sax::XFastShapeContextHandler,
+                                    css::lang::XServiceInfo >
 {
 public:
     explicit ShapeContextHandler
diff --git a/sc/inc/miscuno.hxx b/sc/inc/miscuno.hxx
index 0023a9a..3d04b62 100644
--- a/sc/inc/miscuno.hxx
+++ b/sc/inc/miscuno.hxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/container/XEnumeration.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include "scdllapi.h"
 
 #define SC_SIMPLE_SERVICE_INFO( ClassName, ClassNameAscii, ServiceAscii )            \
@@ -38,7 +39,7 @@ OUString SAL_CALL ClassName::getImplementationName()                      \
 sal_Bool SAL_CALL ClassName::supportsService( const OUString& ServiceName ) \
     throw(::com::sun::star::uno::RuntimeException)                                   \
 {                                                                                    \
-    return !ServiceName.compareToAscii(ServiceAscii);                                \
+    return cppu::supportsService(this, ServiceName);                                \
 }                                                                                    \
 ::com::sun::star::uno::Sequence< OUString >                                   \
     SAL_CALL ClassName::getSupportedServiceNames(void)                           \
diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx
index dec735e..ee19619 100644
--- a/svtools/source/uno/unoimap.cxx
+++ b/svtools/source/uno/unoimap.cxx
@@ -707,15 +707,7 @@ OUString SAL_CALL SvUnoImageMap::getImplementationName(  )
 sal_Bool SAL_CALL SvUnoImageMap::supportsService( const OUString& ServiceName )
     throw(RuntimeException)
 {
-    const Sequence< OUString > aSNL( getSupportedServiceNames() );
-    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;
+    return cppu::supportsService(this, ServiceName);
 }
 
 Sequence< OUString > SAL_CALL SvUnoImageMap::getSupportedServiceNames(  )
diff --git a/vcl/osx/clipboard.cxx b/vcl/osx/clipboard.cxx
index f65d779..ed6ec54 100644
--- a/vcl/osx/clipboard.cxx
+++ b/vcl/osx/clipboard.cxx
@@ -334,9 +334,9 @@ OUString SAL_CALL AquaClipboard::getImplementationName() throw( RuntimeException
     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 )
diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx
index adee7b2..6bcafae 100644
--- a/xmlscript/source/xml_helper/xml_impctx.cxx
+++ b/xmlscript/source/xml_helper/xml_impctx.cxx
@@ -22,12 +22,12 @@
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/implementationentry.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/lang/XInitialization.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
-
+#include <com/sun/star/lang/XServiceInfo.hpp>
 #include <vector>
 #include <boost/unordered_map.hpp>
 
@@ -91,9 +91,10 @@ struct MGuard
 };
 
 class DocumentHandlerImpl :
-    public ::cppu::WeakImplHelper3< xml::sax::XDocumentHandler,
+    public ::cppu::WeakImplHelper4< xml::sax::XDocumentHandler,
                                     xml::input::XNamespaceMapping,
-                                    lang::XInitialization >
+                                    lang::XInitialization,
+                                    com::sun::star::lang::XServiceInfo >
 {
     friend class ExtendedAttributes;
 
@@ -413,17 +414,10 @@ OUString DocumentHandlerImpl::getImplementationName()
     return getImplementationName_DocumentHandlerImpl();
 }
 
-sal_Bool DocumentHandlerImpl::supportsService(
-    OUString const & servicename )
+sal_Bool DocumentHandlerImpl::supportsService( OUString const & servicename )
     throw (RuntimeException)
 {
-    Sequence< OUString > names( getSupportedServiceNames_DocumentHandlerImpl() );
-    for ( sal_Int32 nPos = names.getLength(); nPos--; )
-    {
-        if (names[ nPos ].equals( servicename ))
-            return sal_True;
-    }
-    return sal_False;
+    return cppu::supportsService(this, servicename);
 }
 
 Sequence< OUString > DocumentHandlerImpl::getSupportedServiceNames()


More information about the Libreoffice-commits mailing list