[Libreoffice-commits] core.git: include/connectivity include/sfx2 xmloff/source

Alexandre Vicenzi vicenzi.alexandre at gmail.com
Wed Feb 5 06:01:44 PST 2014


 include/connectivity/CommonTools.hxx                 |   24 +---------
 include/sfx2/sfxuno.hxx                              |   42 +------------------
 xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx |    7 +--
 xmloff/source/transform/OOo2Oasis.cxx                |    5 +-
 xmloff/source/transform/Oasis2OOo.cxx                |    5 +-
 5 files changed, 16 insertions(+), 67 deletions(-)

New commits:
commit 625971b104bd39c0168816f822d1a0c491e25f45
Author: Alexandre Vicenzi <vicenzi.alexandre at gmail.com>
Date:   Wed Feb 5 00:43:23 2014 -0200

    fdo#54938 Convert sfx2, xmloff and connec.. to cppu::supportsService
    
    Change-Id: Ib5d3aabf8aa88ec24e44584047d0405a09fa44ed
    Reviewed-on: https://gerrit.libreoffice.org/7864
    Tested-by: LibreOffice gerrit bot <gerrit at libreoffice.org>
    Reviewed-by: Marcos Souza <marcos.souza.org at gmail.com>

diff --git a/include/connectivity/CommonTools.hxx b/include/connectivity/CommonTools.hxx
index 0fca51e..b8b4df7 100644
--- a/include/connectivity/CommonTools.hxx
+++ b/include/connectivity/CommonTools.hxx
@@ -36,6 +36,7 @@
 #include <osl/interlck.h>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <connectivity/dbtoolsdllapi.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 namespace com { namespace sun { namespace star { namespace util {
     struct Date;
@@ -50,7 +51,6 @@ namespace jvmaccess { class VirtualMachine; }
 
 namespace connectivity
 {
-    //------------------------------------------------------------------------------
     OOO_DLLPUBLIC_DBTOOLS sal_Bool match(const sal_Unicode* pWild, const sal_Unicode* pStr, const sal_Unicode cEscape);
     inline sal_Bool match(const OUString &rWild, const OUString &rStr, const sal_Unicode cEscape)
     {
@@ -62,9 +62,7 @@ namespace connectivity
 
     typedef std::map<OUString,OSQLTable,comphelper::UStringMixLess> OSQLTables;
 
-    // -------------------------------------------------------------------------
     // class ORefVector allows reference counting on a std::vector
-    // -------------------------------------------------------------------------
     template< class VectorVal > class ORefVector
     {
         std::vector< VectorVal > m_vector;
@@ -112,11 +110,10 @@ namespace connectivity
         }
 
     };
-    // -------------------------------------------------------------------------
+
     // class ORowVector incudes refcounting and initialze himself
     // with at least one element. This first element is reserved for
     // the bookmark
-    // -------------------------------------------------------------------------
     template< class VectorVal > class ORowVector : public  ORefVector< VectorVal >
     {
     public:
@@ -127,7 +124,6 @@ namespace connectivity
 
     typedef ORefVector< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> > OSQLColumns;
 
-    // =======================================================================================
     // search from __first to __last the column with the name _rVal
     // when no such column exist __last is returned
     OOO_DLLPUBLIC_DBTOOLS
@@ -135,7 +131,7 @@ namespace connectivity
                                         OSQLColumns::Vector::const_iterator __last,
                                         const OUString& _rVal,
                                         const ::comphelper::UStringMixEqual& _rCase);
-    // =======================================================================================
+
     // search from __first to __last the column with the realname _rVal
     // when no such column exist __last is returned
     OOO_DLLPUBLIC_DBTOOLS
@@ -144,9 +140,7 @@ namespace connectivity
                                                 const OUString& _rVal,
                                                 const ::comphelper::UStringMixEqual& _rCase);
 
-    // =======================================================================================
     // the first two find methods are much faster than the one below
-    // =======================================================================================
     // search from __first to __last the column with the property _rProp equals the value _rVal
     // when no such column exist __last is returned
     OOO_DLLPUBLIC_DBTOOLS
@@ -177,8 +171,6 @@ namespace connectivity
 #endif
 }
 
-//==================================================================================
-
 #define DECLARE_SERVICE_INFO()  \
     virtual OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException); \
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); \
@@ -197,17 +189,9 @@ namespace connectivity
     }   \
     sal_Bool SAL_CALL classname::supportsService( const OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) \
     {   \
-        Sequence< OUString > aSupported(getSupportedServiceNames());             \
-        const OUString* pSupported = aSupported.getConstArray();                 \
-        const OUString* pEnd = pSupported + aSupported.getLength();              \
-        for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)   \
-            ;                                                                           \
-                                                                                        \
-        return pSupported != pEnd;                                                      \
+        return cppu::supportsService(this, _rServiceName); \
     }   \
 
-//==================================================================================
-
 #endif // INCLUDED_CONNECTIVITY_COMMONTOOLS_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxuno.hxx b/include/sfx2/sfxuno.hxx
index 13f8006..1d8f800 100644
--- a/include/sfx2/sfxuno.hxx
+++ b/include/sfx2/sfxuno.hxx
@@ -37,7 +37,7 @@
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/queryinterface.hxx>
 #include <cppuhelper/factory.hxx>
-
+#include <cppuhelper/supportsservice.hxx>
 #include <osl/mutex.hxx>
 #include <rtl/ustring.hxx>
 
@@ -65,11 +65,8 @@ bool GetEncryptionData_Impl( const SfxItemSet* pSet, css::uno::Sequence< css::be
 
 typedef sal_Int32 FrameSearchFlags;
 
-//________________________________________________________________________________________________________________________
 //  macros for declaration and definition of uno-services
-//________________________________________________________________________________________________________________________
 
-//************************************************************************************************************************
 //  declaration of      XInterface::queryInterface()
 //                      XInterface::aquire()
 //                      XInterface::release()
@@ -81,7 +78,6 @@ typedef sal_Int32 FrameSearchFlags;
 //                      static xxx::impl_getStaticSupportedServiceNames()
 //                      static xxx::impl_getStaticImplementationName()
 //                      static xxx::impl_createInstance()
-//************************************************************************************************************************
 #define SFX_DECL_XSERVICEINFO_NOFACTORY                                                                                         \
     /* XServiceInfo */                                                                                                          \
     virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );                                 \
@@ -95,7 +91,6 @@ typedef sal_Int32 FrameSearchFlags;
     /* Helper for registry */                                                                                                   \
     static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception );
 
-//************************************************************************************************************************
 //  declaration of      XInterface::queryInterface()
 //                      XInterface::aquire()
 //                      XInterface::release()
@@ -108,19 +103,16 @@ typedef sal_Int32 FrameSearchFlags;
 //                      static xxx::impl_getStaticImplementationName()
 //                      static xxx::impl_createInstance()
 //                      static xxx::impl_createFactory()
-//************************************************************************************************************************
 #define SFX_DECL_XSERVICEINFO                                                                                             \
     SFX_DECL_XSERVICEINFO_NOFACTORY                                                                                       \
     static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
 
-//************************************************************************************************************************
 //  implementation of   XServiceInfo::getImplementationName()
 //                      XServiceInfo::supportsService()
 //                      XServiceInfo::getSupportedServiceNames()
 //                      static xxx::impl_getStaticSupportedServiceNames()
 //                      static xxx::impl_getStaticImplementationName()
 //                      static xxx::impl_createInstance()
-//************************************************************************************************************************
 #define SFX_IMPL_XSERVICEINFO( IMPLCLASS, IMPLSERVICENAME, IMPLNAME )                                                                               \
                                                                                                                                                     \
     /* XServiceInfo */                                                                                                                              \
@@ -132,16 +124,7 @@ typedef sal_Int32 FrameSearchFlags;
     /* XServiceInfo */                                                                                                                              \
     sal_Bool SAL_CALL IMPLCLASS::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException )                           \
     {                                                                                                                                               \
-        css::uno::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 */                                                                                                                              \
@@ -170,14 +153,12 @@ typedef sal_Int32 FrameSearchFlags;
         return css::uno::Reference< css::uno::XInterface >( *new IMPLCLASS( xServiceManager ) );                                                    \
     }
 
-//************************************************************************************************************************
 //  implementation of   XServiceInfo::getImplementationName()
 //                      XServiceInfo::supportsService()
 //                      XServiceInfo::getSupportedServiceNames()
 //                      static xxx::impl_getStaticSupportedServiceNames()
 //                      static xxx::impl_getStaticImplementationName()
 //                      static xxx::impl_createInstance()
-//************************************************************************************************************************
 #define SFX_IMPL_XSERVICEINFO_CTX( IMPLCLASS, IMPLSERVICENAME, IMPLNAME )                                                                           \
                                                                                                                                                     \
     /* XServiceInfo */                                                                                                                              \
@@ -189,16 +170,7 @@ typedef sal_Int32 FrameSearchFlags;
     /* XServiceInfo */                                                                                                                              \
     sal_Bool SAL_CALL IMPLCLASS::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException )                           \
     {                                                                                                                                               \
-        css::uno::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 */                                                                                                                              \
@@ -227,9 +199,7 @@ typedef sal_Int32 FrameSearchFlags;
         return css::uno::Reference< css::uno::XInterface >( *new IMPLCLASS( comphelper::getComponentContext(xServiceManager) ) );                   \
     }
 
-//************************************************************************************************************************
 //  definition of createFactory() for MultiServices
-//************************************************************************************************************************
 #define SFX_IMPL_SINGLEFACTORY( IMPLCLASS )                                                                                                         \
                                                                                                                                                     \
     css::uno::Reference< css::lang::XSingleServiceFactory > IMPLCLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager )        \
@@ -243,9 +213,7 @@ typedef sal_Int32 FrameSearchFlags;
         return xReturn ;                                                                                                                            \
     }
 
-//************************************************************************************************************************
 //  definition of createFactory() for OneInstance-Services
-//************************************************************************************************************************
 #define SFX_IMPL_ONEINSTANCEFACTORY( IMPLCLASS )                                                                                                    \
                                                                                                                                                     \
     css::uno::Reference< css::lang::XSingleServiceFactory > IMPLCLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager )        \
@@ -259,17 +227,13 @@ typedef sal_Int32 FrameSearchFlags;
         return xReturn ;                                                                                                                            \
     }
 
-//************************************************************************************************************************
 //  definition for "extern c sfx_component_getFactory()"
-//************************************************************************************************************************
 #define CREATEFACTORY(CLASS)                                                                                            \
                                                                                                                         \
     /* Create right factory ... */                                                                                      \
     xFactory = CLASS::impl_createFactory( xServiceManager );
 
-//************************************************************************************************************************
 //  definition for "extern c sfx_component_getFactory()"
-//************************************************************************************************************************
 #define IF_NAME_CREATECOMPONENTFACTORY(CLASS)                                                                           \
                                                                                                                         \
     if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) )    \
diff --git a/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx b/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx
index eb2c0b6..0817d86 100644
--- a/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx
+++ b/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx
@@ -18,7 +18,7 @@
  */
 
 #include <xmloff/XMLEmbeddedObjectExportFilter.hxx>
-
+#include <cppuhelper/supportsservice.hxx>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::xml::sax;
@@ -35,7 +35,6 @@ XMLEmbeddedObjectExportFilter::~XMLEmbeddedObjectExportFilter () throw()
 {
 }
 
-
 void SAL_CALL XMLEmbeddedObjectExportFilter::startDocument( void )
     throw( SAXException, RuntimeException )
 {
@@ -153,10 +152,10 @@ OUString SAL_CALL XMLEmbeddedObjectExportFilter::getImplementationName()
     return aStr;
 }
 
-sal_Bool SAL_CALL XMLEmbeddedObjectExportFilter::supportsService( const OUString& )
+sal_Bool SAL_CALL XMLEmbeddedObjectExportFilter::supportsService( const OUString& ServiceName )
     throw(RuntimeException)
 {
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 Sequence< OUString > SAL_CALL XMLEmbeddedObjectExportFilter::getSupportedServiceNames(  )
diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx
index 9619cbf..e956b4d 100644
--- a/xmloff/source/transform/OOo2Oasis.cxx
+++ b/xmloff/source/transform/OOo2Oasis.cxx
@@ -38,6 +38,7 @@
 #include "PropertyActionsOOo.hxx"
 #include "TransformerActions.hxx"
 #include "OOo2Oasis.hxx"
+#include <cppuhelper/supportsservice.hxx>
 
 using namespace ::xmloff::token;
 using namespace ::com::sun::star::uno;
@@ -2019,10 +2020,10 @@ OUString SAL_CALL OOo2OasisTransformer::getImplementationName()
     return m_aImplName;
 }
 
-sal_Bool SAL_CALL OOo2OasisTransformer::supportsService( const OUString& )
+sal_Bool SAL_CALL OOo2OasisTransformer::supportsService( const OUString& ServiceName )
     throw(RuntimeException)
 {
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 Sequence< OUString > SAL_CALL OOo2OasisTransformer::getSupportedServiceNames(  )
diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx
index 1592679..ff1adbe 100644
--- a/xmloff/source/transform/Oasis2OOo.cxx
+++ b/xmloff/source/transform/Oasis2OOo.cxx
@@ -42,6 +42,7 @@
 #include "FamilyType.hxx"
 #include <comphelper/servicehelper.hxx>
 #include "Oasis2OOo.hxx"
+#include <cppuhelper/supportsservice.hxx>
 
 using namespace ::osl;
 using namespace ::xmloff::token;
@@ -2007,10 +2008,10 @@ OUString SAL_CALL Oasis2OOoTransformer::getImplementationName()
     return Oasis2OOoTransformer_getImplementationName();
 }
 
-sal_Bool SAL_CALL Oasis2OOoTransformer::supportsService( const OUString& )
+sal_Bool SAL_CALL Oasis2OOoTransformer::supportsService( const OUString& ServiceName )
     throw(RuntimeException)
 {
-    return sal_False;
+    return cppu::supportsService(this, ServiceName);
 }
 
 Sequence< OUString > SAL_CALL Oasis2OOoTransformer::getSupportedServiceNames(  )


More information about the Libreoffice-commits mailing list