[Libreoffice-commits] core.git: 12 commits - canvas/source filter/source sfx2/inc sfx2/source sfx2/util solenv/bin svl/source svtools/Library_svt.mk svtools/source svtools/util svx/source

Marcos Paulo de Souza marcos.souza.org at gmail.com
Thu Jan 16 01:26:38 PST 2014


 canvas/source/cairo/cairo_canvasbitmap.cxx                |   10 
 canvas/source/cairo/cairo_canvascustomsprite.cxx          |   10 
 canvas/source/cairo/cairo_canvasfont.cxx                  |   10 
 canvas/source/cairo/cairo_textlayout.cxx                  |   10 
 canvas/source/directx/dx_canvasbitmap.cxx                 |   10 
 canvas/source/directx/dx_canvascustomsprite.cxx           |   10 
 canvas/source/directx/dx_canvasfont.cxx                   |    9 
 canvas/source/directx/dx_textlayout.cxx                   |   12 
 canvas/source/factory/cf_service.cxx                      |    9 
 canvas/source/tools/cachedprimitivebase.cxx               |   10 
 canvas/source/tools/parametricpolypolygon.cxx             |   10 
 canvas/source/vcl/canvasbitmap.cxx                        |   10 
 canvas/source/vcl/canvascustomsprite.cxx                  |   10 
 canvas/source/vcl/canvasfont.cxx                          |   10 
 canvas/source/vcl/textlayout.cxx                          |   11 
 filter/source/config/cache/configflush.cxx                |   20 -
 filter/source/config/cache/configflush.hxx                |    7 
 filter/source/flash/swffilter.cxx                         |   30 -
 filter/source/pdf/pdffilter.cxx                           |   31 -
 filter/source/pdf/pdfinteract.cxx                         |   35 -
 filter/source/placeware/filter.cxx                        |   28 -
 filter/source/t602/t602filter.cxx                         |   38 --
 filter/source/textfilterdetect/filterdetect.cxx           |    9 
 filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx       |   19 -
 filter/source/xmlfilterdetect/filterdetect.cxx            |    7 
 filter/source/xsltdialog/xmlfilterdialogcomponent.cxx     |   27 -
 sfx2/inc/backingcomp.hxx                                  |  148 --------
 sfx2/source/appl/appuno.cxx                               |   96 -----
 sfx2/source/appl/shutdownicon.cxx                         |   39 +-
 sfx2/source/appl/shutdownicon.hxx                         |   16 
 sfx2/source/dialog/backingcomp.cxx                        |  254 ++++++--------
 sfx2/source/doc/SfxDocumentMetaData.cxx                   |   78 +---
 sfx2/source/inc/SfxDocumentMetaData.hxx                   |   49 --
 sfx2/util/sfx.component                                   |   12 
 solenv/bin/native-code.py                                 |    1 
 svl/source/numbers/numfmuno.cxx                           |   23 -
 svl/source/passwordcontainer/passwordcontainer.cxx        |   11 
 svtools/Library_svt.mk                                    |    1 
 svtools/source/control/accessibleruler.cxx                |   20 -
 svtools/source/control/vclxaccessibleheaderbaritem.cxx    |   19 -
 svtools/source/filter/SvFilterOptionsDialog.cxx           |  124 ++++--
 svtools/source/filter/SvFilterOptionsDialog.hxx           |   99 -----
 svtools/source/graphic/graphic.cxx                        |   23 -
 svtools/source/graphic/graphicunofactory.cxx              |   50 ++
 svtools/source/graphic/provider.cxx                       |   20 -
 svtools/source/inc/provider.hxx                           |    5 
 svtools/source/uno/addrtempuno.cxx                        |   65 ---
 svtools/source/uno/miscservices.cxx                       |  136 -------
 svtools/source/uno/unoevent.cxx                           |    4 
 svtools/source/uno/unowizard.hxx                          |  108 -----
 svtools/source/uno/wizard/unowizard.cxx                   |  112 ++++--
 svtools/util/svt.component                                |   14 
 svx/source/accessibility/svxpixelctlaccessiblecontext.cxx |   33 -
 svx/source/inc/unogalthemeprovider.hxx                    |    7 
 svx/source/table/cell.cxx                                 |   19 -
 svx/source/unodraw/UnoNamespaceMap.cxx                    |    5 
 svx/source/unodraw/unoctabl.cxx                           |   10 
 svx/source/unogallery/unogaltheme.cxx                     |   18 
 svx/source/unogallery/unogaltheme.hxx                     |    6 
 svx/source/unogallery/unogalthemeprovider.cxx             |   22 -
 60 files changed, 568 insertions(+), 1481 deletions(-)

New commits:
commit eeeefd6fd87b3cff18ba9078869bdfcd0e351d6f
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Tue Jan 14 13:09:33 2014 -0200

    fdo#54938: Convert filter to cppu::supportsService
    
    final part
    
    Change-Id: If9387b4f7aa8ca694092f51eabeac096c71347eb

diff --git a/filter/source/config/cache/configflush.cxx b/filter/source/config/cache/configflush.cxx
index 4ccdb10..d9715a1 100644
--- a/filter/source/config/cache/configflush.cxx
+++ b/filter/source/config/cache/configflush.cxx
@@ -17,18 +17,15 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include "configflush.hxx"
 #include "constant.hxx"
+#include <cppuhelper/supportsservice.hxx>
 
 #include <osl/diagnose.h>
 
-
 namespace filter{
     namespace config{
 
-
-//-----------------------------------------------
 ConfigFlush::ConfigFlush(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
     : BaseLock   (       )
     , m_xSMGR    (xSMGR  )
@@ -36,12 +33,10 @@ ConfigFlush::ConfigFlush(const css::uno::Reference< css::lang::XMultiServiceFact
 {
 }
 
-//-----------------------------------------------
 ConfigFlush::~ConfigFlush()
 {
 }
 
-//-----------------------------------------------
 OUString SAL_CALL ConfigFlush::getImplementationName()
     throw (css::uno::RuntimeException)
 {
@@ -49,29 +44,18 @@ OUString SAL_CALL ConfigFlush::getImplementationName()
     // <- SAFE
 }
 
-//-----------------------------------------------
 sal_Bool SAL_CALL ConfigFlush::supportsService(const OUString& sServiceName)
     throw (css::uno::RuntimeException)
 {
-          css::uno::Sequence< OUString > lServiceNames = impl_getSupportedServiceNames();
-          sal_Int32                             c             = lServiceNames.getLength();
-    const OUString*                      pNames        = lServiceNames.getConstArray();
-    for (sal_Int32 i=0; i<c; ++i)
-    {
-        if (pNames[i].equals(sServiceName))
-            return sal_True;
-    }
-    return sal_False;
+    return cppu::supportsService(this, sServiceName);
 }
 
-//-----------------------------------------------
 css::uno::Sequence< OUString > SAL_CALL ConfigFlush::getSupportedServiceNames()
     throw (css::uno::RuntimeException)
 {
     return impl_getSupportedServiceNames();
 }
 
-//-----------------------------------------------
 void SAL_CALL ConfigFlush::refresh()
     throw(css::uno::RuntimeException)
 {
diff --git a/filter/source/config/cache/configflush.hxx b/filter/source/config/cache/configflush.hxx
index 664d979..7fa9f98 100644
--- a/filter/source/config/cache/configflush.hxx
+++ b/filter/source/config/cache/configflush.hxx
@@ -23,7 +23,7 @@
 #include <com/sun/star/util/XRefreshable.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <cppuhelper/interfacecontainer.h>
-#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
 
 
 namespace filter{
@@ -39,7 +39,10 @@ namespace filter{
                 type/filter configuration will be changed at runtime.
  */
 class ConfigFlush : public BaseLock
-                  , public ::cppu::WeakImplHelper1< css::util::XRefreshable >
+                  , public ::cppu::WeakImplHelper2<
+                                                    css::util::XRefreshable,
+                                                    css::lang::XServiceInfo
+                                                  >
 {
     //-------------------------------------------
     // member
diff --git a/filter/source/flash/swffilter.cxx b/filter/source/flash/swffilter.cxx
index 4d0ace8..54ea4ef 100644
--- a/filter/source/flash/swffilter.cxx
+++ b/filter/source/flash/swffilter.cxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <comphelper/processfactory.hxx>
 #include <osl/file.hxx>
 
@@ -448,37 +449,20 @@ void SAL_CALL FlashExportFilter::initialize( const ::com::sun::star::uno::Sequen
 {
 }
 
-// -----------------------------------------------------------------------------
-
 OUString FlashExportFilter_getImplementationName ()
     throw (RuntimeException)
 {
     return OUString ( "com.sun.star.comp.Impress.FlashExportFilter" );
 }
 
-// -----------------------------------------------------------------------------
-
-#define SERVICE_NAME "com.sun.star.document.ExportFilter"
-
-sal_Bool SAL_CALL FlashExportFilter_supportsService( const OUString& ServiceName )
-    throw (RuntimeException)
-{
-    return ServiceName == SERVICE_NAME;
-}
-
-// -----------------------------------------------------------------------------
-
 Sequence< OUString > SAL_CALL FlashExportFilter_getSupportedServiceNames(  )
     throw (RuntimeException)
 {
     Sequence < OUString > aRet(1);
     OUString* pArray = aRet.getArray();
-    pArray[0] =  OUString ( SERVICE_NAME );
+    pArray[0] =  "com.sun.star.document.ExportFilter";
     return aRet;
 }
-#undef SERVICE_NAME
-
-// -----------------------------------------------------------------------------
 
 Reference< XInterface > SAL_CALL FlashExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
     throw( Exception )
@@ -486,8 +470,6 @@ Reference< XInterface > SAL_CALL FlashExportFilter_createInstance( const Referen
     return (cppu::OWeakObject*) new FlashExportFilter( comphelper::getComponentContext(rSMgr) );
 }
 
-// -----------------------------------------------------------------------------
-
 // XServiceInfo
 OUString SAL_CALL FlashExportFilter::getImplementationName(  )
     throw (RuntimeException)
@@ -495,24 +477,18 @@ OUString SAL_CALL FlashExportFilter::getImplementationName(  )
     return FlashExportFilter_getImplementationName();
 }
 
-// -----------------------------------------------------------------------------
-
 sal_Bool SAL_CALL FlashExportFilter::supportsService( const OUString& rServiceName )
     throw (RuntimeException)
 {
-    return FlashExportFilter_supportsService( rServiceName );
+    return cppu::supportsService( this, rServiceName );
 }
 
-// -----------------------------------------------------------------------------
-
 ::com::sun::star::uno::Sequence< OUString > SAL_CALL FlashExportFilter::getSupportedServiceNames(  )
     throw (RuntimeException)
 {
     return FlashExportFilter_getSupportedServiceNames();
 }
 
-// -----------------------------------------------------------------------------
-
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index 092cad6..2db9df8 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -17,31 +17,24 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include "pdffilter.hxx"
 #include "pdfexport.hxx"
+#include <cppuhelper/supportsservice.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/window.hxx>
 #include <svl/outstrm.hxx>
 #include <vcl/FilterConfigItem.hxx>
 
-// -------------
 // - PDFFilter -
-// -------------
-
 PDFFilter::PDFFilter( const Reference< XComponentContext > &rxContext ) :
     mxContext( rxContext )
 {
 }
 
-// -----------------------------------------------------------------------------
-
 PDFFilter::~PDFFilter()
 {
 }
 
-// -----------------------------------------------------------------------------
-
 sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
 {
     Reference< XOutputStream >  xOStm;
@@ -200,38 +193,20 @@ void SAL_CALL PDFFilter::initialize( const ::com::sun::star::uno::Sequence< ::co
 {
 }
 
-// -----------------------------------------------------------------------------
-
 OUString PDFFilter_getImplementationName ()
     throw (RuntimeException)
 {
     return OUString ( "com.sun.star.comp.PDF.PDFFilter" );
 }
 
-// -----------------------------------------------------------------------------
-
-#define SERVICE_NAME "com.sun.star.document.PDFFilter"
-
-sal_Bool SAL_CALL PDFFilter_supportsService( const OUString& ServiceName )
-    throw (RuntimeException)
-{
-    return ServiceName == SERVICE_NAME;
-}
-
-// -----------------------------------------------------------------------------
-
 Sequence< OUString > SAL_CALL PDFFilter_getSupportedServiceNames(  ) throw (RuntimeException)
 {
     Sequence < OUString > aRet(1);
     OUString* pArray = aRet.getArray();
-    pArray[0] = SERVICE_NAME;
+    pArray[0] = "com.sun.star.document.PDFFilter";
     return aRet;
 }
 
-#undef SERVICE_NAME
-
-// -----------------------------------------------------------------------------
-
 Reference< XInterface > SAL_CALL PDFFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception )
 {
     return (cppu::OWeakObject*) new PDFFilter( comphelper::getComponentContext(rSMgr) );
@@ -250,7 +225,7 @@ OUString SAL_CALL PDFFilter::getImplementationName()
 sal_Bool SAL_CALL PDFFilter::supportsService( const OUString& rServiceName )
     throw (RuntimeException)
 {
-    return PDFFilter_supportsService( rServiceName );
+    return cppu::supportsService( this, rServiceName );
 }
 
 // -----------------------------------------------------------------------------
diff --git a/filter/source/pdf/pdfinteract.cxx b/filter/source/pdf/pdfinteract.cxx
index 9898f77..13b3cd5 100644
--- a/filter/source/pdf/pdfinteract.cxx
+++ b/filter/source/pdf/pdfinteract.cxx
@@ -23,22 +23,17 @@
 
 #include "com/sun/star/task/XInteractionRequest.hpp"
 #include "com/sun/star/task/PDFExportException.hpp"
+#include <cppuhelper/supportsservice.hxx>
 
-// -------------
 // - PDFInteractionHandler -
-// -------------
-
 PDFInteractionHandler::PDFInteractionHandler()
 {
 }
 
-// -----------------------------------------------------------------------------
-
 PDFInteractionHandler::~PDFInteractionHandler()
 {
 }
 
-
 void SAL_CALL PDFInteractionHandler::handle( const Reference< task::XInteractionRequest >& i_xRequest )
     throw (RuntimeException)
 {
@@ -65,61 +60,37 @@ sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Referen
     return bHandled;
 }
 
-// -----------------------------------------------------------------------------
-
 OUString PDFInteractionHandler_getImplementationName ()
     throw (RuntimeException)
 {
     return OUString ( "com.sun.star.comp.PDF.PDFExportInteractionHandler" );
 }
 
-// -----------------------------------------------------------------------------
-
-#define SERVICE_NAME "com.sun.star.filter.pdfexport.PDFExportInteractionHandler"
-
-sal_Bool SAL_CALL PDFInteractionHandler_supportsService( const OUString& ServiceName )
-    throw (RuntimeException)
-{
-    return ServiceName == SERVICE_NAME;
-}
-
-// -----------------------------------------------------------------------------
-
 Sequence< OUString > SAL_CALL PDFInteractionHandler_getSupportedServiceNames(  ) throw (RuntimeException)
 {
     Sequence < OUString > aRet(1);
     OUString* pArray = aRet.getArray();
-    pArray[0] = SERVICE_NAME;
+    pArray[0] = "com.sun.star.filter.pdfexport.PDFExportInteractionHandler";
     return aRet;
 }
 
-#undef SERVICE_NAME
-
-// -----------------------------------------------------------------------------
-
 Reference< XInterface > SAL_CALL PDFInteractionHandler_createInstance( const Reference< XMultiServiceFactory > & ) throw( Exception )
 {
     return (cppu::OWeakObject*) new PDFInteractionHandler;
 }
 
-// -----------------------------------------------------------------------------
-
 OUString SAL_CALL PDFInteractionHandler::getImplementationName()
     throw (RuntimeException)
 {
     return PDFInteractionHandler_getImplementationName();
 }
 
-// -----------------------------------------------------------------------------
-
 sal_Bool SAL_CALL PDFInteractionHandler::supportsService( const OUString& rServiceName )
     throw (RuntimeException)
 {
-    return PDFInteractionHandler_supportsService( rServiceName );
+    return cppu::supportsService( this, rServiceName );
 }
 
-// -----------------------------------------------------------------------------
-
 ::com::sun::star::uno::Sequence< OUString > SAL_CALL PDFInteractionHandler::getSupportedServiceNames(  ) throw (RuntimeException)
 {
     return PDFInteractionHandler_getSupportedServiceNames();
diff --git a/filter/source/placeware/filter.cxx b/filter/source/placeware/filter.cxx
index b2f7c98..9077bcb 100644
--- a/filter/source/placeware/filter.cxx
+++ b/filter/source/placeware/filter.cxx
@@ -22,6 +22,7 @@
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <comphelper/processfactory.hxx>
 
 #include "exporter.hxx"
@@ -139,37 +140,20 @@ void SAL_CALL PlaceWareExportFilter::initialize( const ::com::sun::star::uno::Se
 {
 }
 
-// -----------------------------------------------------------------------------
-
 OUString PlaceWareExportFilter_getImplementationName ()
     throw (RuntimeException)
 {
     return OUString( "com.sun.star.comp.Impress.PlaceWareExportFilter" );
 }
 
-// -----------------------------------------------------------------------------
-
-#define SERVICE_NAME "com.sun.star.document.ExportFilter"
-
-sal_Bool SAL_CALL PlaceWareExportFilter_supportsService( const OUString& ServiceName )
-    throw (RuntimeException)
-{
-    return ServiceName == SERVICE_NAME;
-}
-
-// -----------------------------------------------------------------------------
-
 Sequence< OUString > SAL_CALL PlaceWareExportFilter_getSupportedServiceNames(  )
     throw (RuntimeException)
 {
     Sequence < OUString > aRet(1);
     OUString* pArray = aRet.getArray();
-    pArray[0] =  OUString ( SERVICE_NAME );
+    pArray[0] =  "com.sun.star.document.ExportFilter";
     return aRet;
 }
-#undef SERVICE_NAME
-
-// -----------------------------------------------------------------------------
 
 Reference< XInterface > SAL_CALL PlaceWareExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
     throw( Exception )
@@ -177,8 +161,6 @@ Reference< XInterface > SAL_CALL PlaceWareExportFilter_createInstance( const Ref
     return (cppu::OWeakObject*) new PlaceWareExportFilter( comphelper::getComponentContext(rSMgr) );
 }
 
-// -----------------------------------------------------------------------------
-
 // XServiceInfo
 OUString SAL_CALL PlaceWareExportFilter::getImplementationName(  )
     throw (RuntimeException)
@@ -186,16 +168,12 @@ OUString SAL_CALL PlaceWareExportFilter::getImplementationName(  )
     return PlaceWareExportFilter_getImplementationName();
 }
 
-// -----------------------------------------------------------------------------
-
 sal_Bool SAL_CALL PlaceWareExportFilter::supportsService( const OUString& rServiceName )
     throw (RuntimeException)
 {
-    return PlaceWareExportFilter_supportsService( rServiceName );
+    return cppu::supportsService( this, rServiceName );
 }
 
-// -----------------------------------------------------------------------------
-
 ::com::sun::star::uno::Sequence< OUString > SAL_CALL PlaceWareExportFilter::getSupportedServiceNames(  )
     throw (RuntimeException)
 {
diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx
index a5c3842..bdfbe4f 100644
--- a/filter/source/t602/t602filter.cxx
+++ b/filter/source/t602/t602filter.cxx
@@ -25,6 +25,7 @@
 
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/bootstrap.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/bridge/XUnoUrlResolver.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -849,7 +850,7 @@ OUString SAL_CALL T602ImportFilter::getImplementationName(  )
 sal_Bool SAL_CALL T602ImportFilter::supportsService( const OUString& rServiceName )
     throw (RuntimeException)
 {
-    return T602ImportFilter_supportsService( rServiceName );
+    return cppu::supportsService( this, rServiceName );
 }
 
 Sequence< OUString > SAL_CALL T602ImportFilter::getSupportedServiceNames(  )
@@ -858,20 +859,10 @@ Sequence< OUString > SAL_CALL T602ImportFilter::getSupportedServiceNames(  )
     return T602ImportFilter_getSupportedServiceNames();
 }
 
-#define IMPLEMENTATION_NAME "com.sun.star.comp.Writer.T602ImportFilter"
-
 OUString T602ImportFilter_getImplementationName ()
     throw (RuntimeException)
 {
-    return OUString (  IMPLEMENTATION_NAME  );
-}
-
-#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
-#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
-sal_Bool SAL_CALL T602ImportFilter_supportsService( const OUString& ServiceName )
-    throw (RuntimeException)
-{
-    return ( ServiceName == SERVICE_NAME1 || ServiceName == SERVICE_NAME2 );
+    return OUString ( "com.sun.star.comp.Writer.T602ImportFilter" );
 }
 
 Sequence< OUString > SAL_CALL T602ImportFilter_getSupportedServiceNames(  )
@@ -879,13 +870,10 @@ Sequence< OUString > SAL_CALL T602ImportFilter_getSupportedServiceNames(  )
 {
     Sequence < OUString > aRet(2);
     OUString* pArray = aRet.getArray();
-    pArray[0] =  OUString (  SERVICE_NAME1  );
-    pArray[1] =  OUString (  SERVICE_NAME2  );
+    pArray[0] =  "com.sun.star.document.ImportFilter";
+    pArray[1] =  "com.sun.star.document.ExtendedTypeDetection";
     return aRet;
 }
-#undef SERVICE_NAME2
-#undef SERVICE_NAME1
-#undef IMPLEMENTATION_NAME
 
 Reference< XInterface > SAL_CALL T602ImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
     throw( Exception )
@@ -1155,7 +1143,7 @@ OUString SAL_CALL T602ImportFilterDialog::getImplementationName(  )
 sal_Bool SAL_CALL T602ImportFilterDialog::supportsService( const OUString& rServiceName )
     throw (RuntimeException)
 {
-    return T602ImportFilterDialog_supportsService( rServiceName );
+    return cppu::supportsService( this, rServiceName );
 }
 
 Sequence< OUString > SAL_CALL T602ImportFilterDialog::getSupportedServiceNames(  )
@@ -1164,19 +1152,10 @@ Sequence< OUString > SAL_CALL T602ImportFilterDialog::getSupportedServiceNames(
     return T602ImportFilterDialog_getSupportedServiceNames();
 }
 
-#define IMPLEMENTATION_NAME "com.sun.star.comp.Writer.T602ImportFilterDialog"
-
 OUString T602ImportFilterDialog_getImplementationName ()
     throw (RuntimeException)
 {
-    return OUString (  IMPLEMENTATION_NAME  );
-}
-
-#define SERVICE_NAME "com.sun.star.ui.dialogs.FilterOptionsDialog"
-sal_Bool SAL_CALL T602ImportFilterDialog_supportsService( const OUString& ServiceName )
-    throw (RuntimeException)
-{
-    return ServiceName == SERVICE_NAME;
+    return OUString ( "com.sun.star.comp.Writer.T602ImportFilterDialog" );
 }
 
 Sequence< OUString > SAL_CALL T602ImportFilterDialog_getSupportedServiceNames(  )
@@ -1184,10 +1163,9 @@ Sequence< OUString > SAL_CALL T602ImportFilterDialog_getSupportedServiceNames(
 {
     Sequence < OUString > aRet(1);
     OUString* pArray = aRet.getArray();
-    pArray[0] =  OUString (  SERVICE_NAME  );
+    pArray[0] =  "com.sun.star.ui.dialogs.FilterOptionsDialog";
     return aRet;
 }
-#undef SERVICE_NAME
 
 Reference< XInterface > SAL_CALL T602ImportFilterDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
     throw( Exception )
diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
index deaeecd8..affcf34 100644
--- a/filter/source/textfilterdetect/filterdetect.cxx
+++ b/filter/source/textfilterdetect/filterdetect.cxx
@@ -14,6 +14,7 @@
 
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 #define WRITER_TEXT_FILTER "Text"
 #define CALC_TEXT_FILTER   "Text - txt - csv (StarCalc)"
@@ -118,12 +119,6 @@ OUString PlainTextFilterDetect_getImplementationName()
     return OUString("com.sun.star.comp.filters.PlainTextFilterDetect");
 }
 
-sal_Bool PlainTextFilterDetect_supportsService(const OUString& ServiceName)
-{
-    return ServiceName == "com.sun.star.document.ExtendedTypeDetection" ||
-        ServiceName == "com.sun.star.comp.filters.PlainTextFilterDetect";
-}
-
 uno::Sequence<OUString> PlainTextFilterDetect_getSupportedServiceNames()
 {
     uno::Sequence<OUString> aRet(2);
@@ -149,7 +144,7 @@ OUString SAL_CALL PlainTextFilterDetect::getImplementationName()
 sal_Bool SAL_CALL PlainTextFilterDetect::supportsService(const OUString& rServiceName)
     throw (uno::RuntimeException)
 {
-    return PlainTextFilterDetect_supportsService(rServiceName);
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence<OUString> SAL_CALL PlainTextFilterDetect::getSupportedServiceNames()
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index 539f746..465cdcc 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -48,6 +48,7 @@
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <comphelper/genericpropertyset.hxx>
 #include <comphelper/propertysetinfo.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <unotools/pathoptions.hxx>
 
 using namespace comphelper;
@@ -354,24 +355,16 @@ OUString XmlFilterAdaptor_getImplementationName ()
 {
     return OUString( "com.sun.star.comp.Writer.XmlFilterAdaptor" );
 }
-#define SERVICE_NAME1 "com.sun.star.document.ExportFilter"
-#define SERVICE_NAME2 "com.sun.star.document.ImportFilter"
-sal_Bool SAL_CALL XmlFilterAdaptor_supportsService( const OUString& ServiceName )
-    throw (RuntimeException)
-{
-    return ServiceName == SERVICE_NAME1 || ServiceName == SERVICE_NAME2;
-}
+
 Sequence< OUString > SAL_CALL XmlFilterAdaptor_getSupportedServiceNames(  )
     throw (RuntimeException)
 {
     Sequence < OUString > aRet(2);
     OUString* pArray = aRet.getArray();
-    pArray[0] =  OUString ( SERVICE_NAME1 );
-    pArray[1] =  OUString ( SERVICE_NAME2 );
+    pArray[0] =  "com.sun.star.document.ExportFilter";
+    pArray[1] =  "com.sun.star.document.ImportFilter";
     return aRet;
 }
-#undef SERVICE_NAME1
-#undef SERVICE_NAME2
 
 Reference< XInterface > SAL_CALL XmlFilterAdaptor_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
     throw( Exception )
@@ -385,11 +378,13 @@ OUString SAL_CALL XmlFilterAdaptor::getImplementationName(  )
 {
     return XmlFilterAdaptor_getImplementationName();
 }
+
 sal_Bool SAL_CALL XmlFilterAdaptor::supportsService( const OUString& rServiceName )
     throw (RuntimeException)
 {
-    return XmlFilterAdaptor_supportsService( rServiceName );
+    return cppu::supportsService( this, rServiceName );
 }
+
 Sequence< OUString > SAL_CALL XmlFilterAdaptor::getSupportedServiceNames(  )
     throw (RuntimeException)
 {
diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx
index c409d82..ce48dfb 100644
--- a/filter/source/xmlfilterdetect/filterdetect.cxx
+++ b/filter/source/xmlfilterdetect/filterdetect.cxx
@@ -41,6 +41,7 @@
 #include <com/sun/star/document/XExtendedFilterDetection.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/beans/PropertyState.hpp>
+#include <cppuhelper/supportsservice.hxx>
 #include <ucbhelper/content.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <boost/scoped_ptr.hpp>
@@ -248,12 +249,11 @@ OUString FilterDetect_getImplementationName ()
 {
     return OUString( "com.sun.star.comp.filters.XMLFilterDetect" );
 }
-#define SERVICE_NAME1 "com.sun.star.document.ExtendedTypeDetection"
 
 Sequence< OUString > FilterDetect_getSupportedServiceNames()
 {
     Sequence < OUString > aRet(1);
-    aRet[0] = SERVICE_NAME1;
+    aRet[0] = "com.sun.star.document.ExtendedTypeDetection";
     return aRet;
 }
 
@@ -271,8 +271,9 @@ OUString SAL_CALL FilterDetect::getImplementationName(  )
 sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName )
     throw (RuntimeException)
 {
-    return rServiceName == SERVICE_NAME1;
+    return cppu::supportsService( this, rServiceName );
 }
+
 Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames(  )
     throw (RuntimeException)
 {
diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
index 4fe62c9..1edb72c 100644
--- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
+++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/frame/XTerminateListener.hpp>
 #include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/awt/XWindow.hpp>
@@ -193,8 +194,6 @@ OUString XMLFilterDialogComponent_getImplementationName() throw ( RuntimeExcepti
     return OUString( "com.sun.star.comp.ui.XSLTFilterDialog" );
 }
 
-//-------------------------------------------------------------------------
-
 Sequence< OUString > SAL_CALL XMLFilterDialogComponent_getSupportedServiceNames()  throw ( RuntimeException )
 {
     Sequence< OUString > aSupported(1);
@@ -202,33 +201,16 @@ Sequence< OUString > SAL_CALL XMLFilterDialogComponent_getSupportedServiceNames(
     return aSupported;
 }
 
-//-------------------------------------------------------------------------
-
-sal_Bool SAL_CALL XMLFilterDialogComponent_supportsService( const OUString& ServiceName ) throw ( RuntimeException )
-{
-    Sequence< OUString > aSupported(XMLFilterDialogComponent_getSupportedServiceNames());
-    const OUString* pArray = aSupported.getConstArray();
-    for (sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pArray)
-        if (pArray->equals(ServiceName))
-            return sal_True;
-    return sal_False;
-}
-
-//-------------------------------------------------------------------------
-
 Reference< XInterface > SAL_CALL XMLFilterDialogComponent_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception )
 {
     return (OWeakObject*)new XMLFilterDialogComponent( comphelper::getComponentContext(rSMgr) );
 }
 
-//-------------------------------------------------------------------------
 OUString SAL_CALL XMLFilterDialogComponent::getImplementationName() throw(com::sun::star::uno::RuntimeException)
 {
     return XMLFilterDialogComponent_getImplementationName();
 }
 
-//-------------------------------------------------------------------------
-
 namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
 
 Sequence< sal_Int8 > SAL_CALL XMLFilterDialogComponent::getImplementationId( void ) throw( RuntimeException )
@@ -269,21 +251,16 @@ Sequence< Type > XMLFilterDialogComponent::getTypes() throw (RuntimeException)
     return theDialogComponentTypes::get().getTypeCollection().getTypes();
 }
 
-//-------------------------------------------------------------------------
-
 Sequence< OUString > SAL_CALL XMLFilterDialogComponent::getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException)
 {
     return XMLFilterDialogComponent_getSupportedServiceNames();
 }
 
-//-------------------------------------------------------------------------
 sal_Bool SAL_CALL XMLFilterDialogComponent::supportsService(const OUString& ServiceName) throw(RuntimeException)
 {
-    return XMLFilterDialogComponent_supportsService( ServiceName );
+    return cppu::supportsService( this, ServiceName );
 }
 
-//-------------------------------------------------------------------------
-
 /** Called in dispose method after the listeners were notified.
 */
 void SAL_CALL XMLFilterDialogComponent::disposing()
commit ccf47bd943bf8d09e60fd3310ba31d550e744765
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Tue Jan 14 13:05:02 2014 -0200

    fdo#54938: Convert canvas to cppu::supportsService
    
    Final part
    
    Change-Id: I5ff8e4aacf7be7c0cb1eab520f01cc312143641e

diff --git a/canvas/source/cairo/cairo_canvasbitmap.cxx b/canvas/source/cairo/cairo_canvasbitmap.cxx
index 277c133..380499f 100644
--- a/canvas/source/cairo/cairo_canvasbitmap.cxx
+++ b/canvas/source/cairo/cairo_canvasbitmap.cxx
@@ -19,6 +19,7 @@
 
 #include <canvas/debug.hxx>
 #include <canvas/canvastools.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <tools/diagnose_ex.h>
 
 #include "cairo_canvasbitmap.hxx"
@@ -259,23 +260,20 @@ namespace cairocanvas
         return aRV;
     }
 
-#define IMPLEMENTATION_NAME "CairoCanvas.CanvasBitmap"
-#define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap"
-
     OUString SAL_CALL CanvasBitmap::getImplementationName(  ) throw (uno::RuntimeException)
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "CairoCanvas.CanvasBitmap" );
     }
 
     sal_Bool SAL_CALL CanvasBitmap::supportsService( const OUString& ServiceName ) throw (uno::RuntimeException)
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL CanvasBitmap::getSupportedServiceNames(  ) throw (uno::RuntimeException)
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = SERVICE_NAME;
+        aRet[0] = "com.sun.star.rendering.CanvasBitmap";
 
         return aRet;
     }
diff --git a/canvas/source/cairo/cairo_canvascustomsprite.cxx b/canvas/source/cairo/cairo_canvascustomsprite.cxx
index e0c59b7..b772406 100644
--- a/canvas/source/cairo/cairo_canvascustomsprite.cxx
+++ b/canvas/source/cairo/cairo_canvascustomsprite.cxx
@@ -19,6 +19,7 @@
 
 #include <canvas/debug.hxx>
 #include <canvas/verbosetrace.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <tools/diagnose_ex.h>
 
 #include <rtl/math.hxx>
@@ -138,23 +139,20 @@ namespace cairocanvas
         return mpSpriteCanvas->getOutputDevice();
     }
 
-#define IMPLEMENTATION_NAME "CairoCanvas.CanvasCustomSprite"
-#define SERVICE_NAME "com.sun.star.rendering.CanvasCustomSprite"
-
     OUString SAL_CALL CanvasCustomSprite::getImplementationName() throw( uno::RuntimeException )
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "CairoCanvas.CanvasCustomSprite" );
     }
 
     sal_Bool SAL_CALL CanvasCustomSprite::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL CanvasCustomSprite::getSupportedServiceNames()  throw( uno::RuntimeException )
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = SERVICE_NAME;
+        aRet[0] = "com.sun.star.rendering.CanvasCustomSprite";
 
         return aRet;
     }
diff --git a/canvas/source/cairo/cairo_canvasfont.cxx b/canvas/source/cairo/cairo_canvasfont.cxx
index 4c627f7..7a1a78e 100644
--- a/canvas/source/cairo/cairo_canvasfont.cxx
+++ b/canvas/source/cairo/cairo_canvasfont.cxx
@@ -20,6 +20,7 @@
 #include <canvas/debug.hxx>
 
 #include <com/sun/star/rendering/PanoseProportion.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <rtl/math.hxx>
 #include <basegfx/numeric/ftools.hxx>
@@ -138,23 +139,20 @@ namespace cairocanvas
         return uno::Sequence< beans::PropertyValue >();
     }
 
-#define IMPLEMENTATION_NAME "CairoCanvas::CanvasFont"
-#define SERVICE_NAME "com.sun.star.rendering.CanvasFont"
-
     OUString SAL_CALL CanvasFont::getImplementationName() throw( uno::RuntimeException )
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "CairoCanvas::CanvasFont" );
     }
 
     sal_Bool SAL_CALL CanvasFont::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL CanvasFont::getSupportedServiceNames()  throw( uno::RuntimeException )
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = SERVICE_NAME;
+        aRet[0] = "com.sun.star.rendering.CanvasFont";
 
         return aRet;
     }
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index 35defcd..3477c1b 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -21,6 +21,7 @@
 
 #include <canvas/debug.hxx>
 #include <canvas/verbosetrace.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <tools/diagnose_ex.h>
 
 #include <vcl/metric.hxx>
@@ -631,23 +632,20 @@ namespace cairocanvas
                           OffsetTransformer( aMatrix ) );
     }
 
-#define SERVICE_NAME "com.sun.star.rendering.TextLayout"
-#define IMPLEMENTATION_NAME "CairoCanvas::TextLayout"
-
     OUString SAL_CALL TextLayout::getImplementationName() throw( uno::RuntimeException )
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "CairoCanvas::TextLayout" );
     }
 
     sal_Bool SAL_CALL TextLayout::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL TextLayout::getSupportedServiceNames()  throw( uno::RuntimeException )
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = OUString( SERVICE_NAME );
+        aRet[0] = "com.sun.star.rendering.TextLayout";
 
         return aRet;
     }
diff --git a/canvas/source/directx/dx_canvasbitmap.cxx b/canvas/source/directx/dx_canvasbitmap.cxx
index 1527896..2d14d3f 100644
--- a/canvas/source/directx/dx_canvasbitmap.cxx
+++ b/canvas/source/directx/dx_canvasbitmap.cxx
@@ -21,6 +21,7 @@
 #include <ctype.h>
 #include <canvas/debug.hxx>
 #include <canvas/canvastools.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <tools/diagnose_ex.h>
 
 #include <vcl/bitmapex.hxx>
@@ -243,23 +244,20 @@ namespace dxcanvas
         return aRes;
     }
 
-#define IMPLEMENTATION_NAME "DXCanvas.CanvasBitmap"
-#define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap"
-
     OUString SAL_CALL CanvasBitmap::getImplementationName(  ) throw (uno::RuntimeException)
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "DXCanvas.CanvasBitmap" );
     }
 
     sal_Bool SAL_CALL CanvasBitmap::supportsService( const OUString& ServiceName ) throw (uno::RuntimeException)
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL CanvasBitmap::getSupportedServiceNames(  ) throw (uno::RuntimeException)
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = SERVICE_NAME;
+        aRet[0] = "com.sun.star.rendering.CanvasBitmap";
 
         return aRet;
     }
diff --git a/canvas/source/directx/dx_canvascustomsprite.cxx b/canvas/source/directx/dx_canvascustomsprite.cxx
index 3aac160..1be4db5 100644
--- a/canvas/source/directx/dx_canvascustomsprite.cxx
+++ b/canvas/source/directx/dx_canvascustomsprite.cxx
@@ -21,6 +21,7 @@
 #include <ctype.h>
 #include <canvas/debug.hxx>
 #include <canvas/verbosetrace.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <tools/diagnose_ex.h>
 
 #include <rtl/math.hxx>
@@ -82,23 +83,20 @@ namespace dxcanvas
         CanvasCustomSpriteBaseT::disposeThis();
     }
 
-#define IMPLEMENTATION_NAME "DXCanvas.CanvasCustomSprite"
-#define SERVICE_NAME "com.sun.star.rendering.CanvasCustomSprite"
-
     OUString SAL_CALL CanvasCustomSprite::getImplementationName() throw( uno::RuntimeException )
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "DXCanvas.CanvasCustomSprite" );
     }
 
     sal_Bool SAL_CALL CanvasCustomSprite::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL CanvasCustomSprite::getSupportedServiceNames()  throw( uno::RuntimeException )
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = SERVICE_NAME;
+        aRet[0] = "com.sun.star.rendering.CanvasCustomSprite";
 
         return aRet;
     }
diff --git a/canvas/source/directx/dx_canvasfont.cxx b/canvas/source/directx/dx_canvasfont.cxx
index 3d0d564..9362cac 100644
--- a/canvas/source/directx/dx_canvasfont.cxx
+++ b/canvas/source/directx/dx_canvasfont.cxx
@@ -119,23 +119,20 @@ namespace dxcanvas
         return rendering::FontMetrics();
     }
 
-#define SERVICE_NAME "com.sun.star.rendering.CanvasFont"
-#define IMPLEMENTATION_NAME "DXCanvas::CanvasFont"
-
     OUString SAL_CALL CanvasFont::getImplementationName() throw( uno::RuntimeException )
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "DXCanvas::CanvasFont" );
     }
 
     sal_Bool SAL_CALL CanvasFont::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL CanvasFont::getSupportedServiceNames()  throw( uno::RuntimeException )
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = SERVICE_NAME;
+        aRet[0] = "com.sun.star.rendering.CanvasFont";
 
         return aRet;
     }
diff --git a/canvas/source/directx/dx_textlayout.cxx b/canvas/source/directx/dx_textlayout.cxx
index 4909b01..6ac0d70 100644
--- a/canvas/source/directx/dx_textlayout.cxx
+++ b/canvas/source/directx/dx_textlayout.cxx
@@ -21,6 +21,7 @@
 #include <ctype.h>
 #include <canvas/debug.hxx>
 #include <canvas/verbosetrace.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <basegfx/numeric/ftools.hxx>
@@ -29,7 +30,6 @@
 #include "dx_spritecanvas.hxx"
 #include "dx_textlayout_drawhelper.hxx"
 
-
 using namespace ::com::sun::star;
 
 namespace dxcanvas
@@ -246,24 +246,20 @@ namespace dxcanvas
         return true;
     }
 
-
-#define SERVICE_NAME "com.sun.star.rendering.TextLayout"
-#define IMPLEMENTATION_NAME "DXCanvas::TextLayout"
-
     OUString SAL_CALL TextLayout::getImplementationName() throw( uno::RuntimeException )
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "DXCanvas::TextLayout" );
     }
 
     sal_Bool SAL_CALL TextLayout::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL TextLayout::getSupportedServiceNames()  throw( uno::RuntimeException )
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = SERVICE_NAME;
+        aRet[0] = "com.sun.star.rendering.TextLayout";
 
         return aRet;
     }
diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx
index 441ec15..60306f6 100644
--- a/canvas/source/factory/cf_service.cxx
+++ b/canvas/source/factory/cf_service.cxx
@@ -23,6 +23,7 @@
 #include <cppuhelper/implementationentry.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
@@ -59,7 +60,6 @@ Sequence<OUString> SAL_CALL getSuppServices()
     return Sequence<OUString>(&name, 1);
 }
 
-//==============================================================================
 class CanvasFactory
     : public ::cppu::WeakImplHelper3< lang::XServiceInfo,
                                       lang::XMultiComponentFactory,
@@ -226,20 +226,17 @@ Reference<XInterface> create( Reference<XComponentContext> const & xContext )
 }
 
 // XServiceInfo
-//______________________________________________________________________________
 OUString CanvasFactory::getImplementationName() throw (RuntimeException)
 {
     return getImplName();
 }
 
-//______________________________________________________________________________
 sal_Bool CanvasFactory::supportsService( OUString const & serviceName )
     throw (RuntimeException)
 {
-    return serviceName.equals(getSuppServices()[0]);
+    return cppu::supportsService(this, serviceName);
 }
 
-//______________________________________________________________________________
 Sequence<OUString> CanvasFactory::getSupportedServiceNames()
     throw (RuntimeException)
 {
@@ -247,7 +244,6 @@ Sequence<OUString> CanvasFactory::getSupportedServiceNames()
 }
 
 // XMultiComponentFactory
-//______________________________________________________________________________
 Sequence<OUString> CanvasFactory::getAvailableServiceNames()
     throw (RuntimeException)
 {
@@ -259,7 +255,6 @@ Sequence<OUString> CanvasFactory::getAvailableServiceNames()
     return aServiceNames;
 }
 
-//______________________________________________________________________________
 Reference<XInterface> CanvasFactory::createInstanceWithContext(
     OUString const & name, Reference<XComponentContext> const & xContext )
     throw (Exception)
diff --git a/canvas/source/tools/cachedprimitivebase.cxx b/canvas/source/tools/cachedprimitivebase.cxx
index 63a62b5..89067e1 100644
--- a/canvas/source/tools/cachedprimitivebase.cxx
+++ b/canvas/source/tools/cachedprimitivebase.cxx
@@ -22,15 +22,13 @@
 #include <canvas/base/cachedprimitivebase.hxx>
 
 #include <com/sun/star/rendering/RepaintResult.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <basegfx/tools/canvastools.hxx>
 
 using namespace ::com::sun::star;
 
-#define IMPLEMENTATION_NAME "canvas::CachedPrimitiveBase"
-#define SERVICE_NAME "com.sun.star.rendering.CachedBitmap"
-
 namespace canvas
 {
     CachedPrimitiveBase::CachedPrimitiveBase( const rendering::ViewState&                   rUsedViewState,
@@ -83,18 +81,18 @@ namespace canvas
 
     OUString SAL_CALL CachedPrimitiveBase::getImplementationName(  ) throw (uno::RuntimeException)
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString("canvas::CachedPrimitiveBase");
     }
 
     sal_Bool SAL_CALL CachedPrimitiveBase::supportsService( const OUString& ServiceName ) throw (uno::RuntimeException)
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService(this, ServiceName);
     }
 
     uno::Sequence< OUString > SAL_CALL CachedPrimitiveBase::getSupportedServiceNames(  ) throw (uno::RuntimeException)
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = SERVICE_NAME;
+        aRet[0] = "com.sun.star.rendering.CachedBitmap";
 
         return aRet;
     }
diff --git a/canvas/source/tools/parametricpolypolygon.cxx b/canvas/source/tools/parametricpolypolygon.cxx
index 11ca7ed..67b15d6 100644
--- a/canvas/source/tools/parametricpolypolygon.cxx
+++ b/canvas/source/tools/parametricpolypolygon.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include <canvas/debug.hxx>
 #include <canvas/canvastools.hxx>
 
@@ -30,6 +29,7 @@
 #include <basegfx/tools/canvastools.hxx>
 #include <basegfx/numeric/ftools.hxx>
 #include <basegfx/tools/tools.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <limits>
 
@@ -199,23 +199,21 @@ namespace canvas
         return mxDevice.is() ? mxDevice->getDeviceColorSpace() : uno::Reference< rendering::XColorSpace >();
     }
 
-#define IMPLEMENTATION_NAME "Canvas::ParametricPolyPolygon"
-#define SERVICE_NAME "com.sun.star.rendering.ParametricPolyPolygon"
 
     OUString SAL_CALL ParametricPolyPolygon::getImplementationName(  ) throw (uno::RuntimeException)
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "Canvas::ParametricPolyPolygon" );
     }
 
     sal_Bool SAL_CALL ParametricPolyPolygon::supportsService( const OUString& ServiceName ) throw (uno::RuntimeException)
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService(this, ServiceName);
     }
 
     uno::Sequence< OUString > SAL_CALL ParametricPolyPolygon::getSupportedServiceNames(  ) throw (uno::RuntimeException)
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = SERVICE_NAME;
+        aRet[0] = "com.sun.star.rendering.ParametricPolyPolygon";
 
         return aRet;
     }
diff --git a/canvas/source/vcl/canvasbitmap.cxx b/canvas/source/vcl/canvasbitmap.cxx
index a469e44..0585fa7 100644
--- a/canvas/source/vcl/canvasbitmap.cxx
+++ b/canvas/source/vcl/canvasbitmap.cxx
@@ -17,8 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include <canvas/debug.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <tools/diagnose_ex.h>
 #include "canvasbitmap.hxx"
 
@@ -71,23 +71,21 @@ namespace vclcanvas
         maCanvasHelper.init( rBitmap, rDevice, rOutDevProvider );
     }
 
-#define IMPLEMENTATION_NAME "VCLCanvas.CanvasBitmap"
-#define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap"
 
     OUString SAL_CALL CanvasBitmap::getImplementationName(  ) throw (uno::RuntimeException)
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "VCLCanvas.CanvasBitmap" );
     }
 
     sal_Bool SAL_CALL CanvasBitmap::supportsService( const OUString& ServiceName ) throw (uno::RuntimeException)
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL CanvasBitmap::getSupportedServiceNames(  ) throw (uno::RuntimeException)
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = OUString( SERVICE_NAME );
+        aRet[0] = "com.sun.star.rendering.CanvasBitmap";
 
         return aRet;
     }
diff --git a/canvas/source/vcl/canvascustomsprite.cxx b/canvas/source/vcl/canvascustomsprite.cxx
index 9dead83..9833950 100644
--- a/canvas/source/vcl/canvascustomsprite.cxx
+++ b/canvas/source/vcl/canvascustomsprite.cxx
@@ -21,6 +21,7 @@
 #include <canvas/debug.hxx>
 #include <tools/diagnose_ex.h>
 #include <canvas/verbosetrace.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <rtl/math.hxx>
 
@@ -117,23 +118,20 @@ namespace vclcanvas
         maCanvasHelper.clear();
     }
 
-#define IMPLEMENTATION_NAME "VCLCanvas.CanvasCustomSprite"
-#define SERVICE_NAME "com.sun.star.rendering.CanvasCustomSprite"
-
     OUString SAL_CALL CanvasCustomSprite::getImplementationName() throw( uno::RuntimeException )
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "VCLCanvas.CanvasCustomSprite" );
     }
 
     sal_Bool SAL_CALL CanvasCustomSprite::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL CanvasCustomSprite::getSupportedServiceNames()  throw( uno::RuntimeException )
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = OUString( SERVICE_NAME );
+        aRet[0] = "com.sun.star.rendering.CanvasCustomSprite";
 
         return aRet;
     }
diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx
index 783ace1..6229072 100644
--- a/canvas/source/vcl/canvasfont.cxx
+++ b/canvas/source/vcl/canvasfont.cxx
@@ -26,6 +26,7 @@
 #include <vcl/metric.hxx>
 
 #include <com/sun/star/rendering/PanoseProportion.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 #include "canvasfont.hxx"
 #include "textlayout.hxx"
@@ -150,23 +151,20 @@ namespace vclcanvas
         return uno::Sequence< beans::PropertyValue >();
     }
 
-#define IMPLEMENTATION_NAME "VCLCanvas::CanvasFont"
-#define SERVICE_NAME "com.sun.star.rendering.CanvasFont"
-
     OUString SAL_CALL CanvasFont::getImplementationName() throw( uno::RuntimeException )
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "VCLCanvas::CanvasFont" );
     }
 
     sal_Bool SAL_CALL CanvasFont::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL CanvasFont::getSupportedServiceNames()  throw( uno::RuntimeException )
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = OUString( SERVICE_NAME );
+        aRet[0] = "com.sun.star.rendering.CanvasFont";
 
         return aRet;
     }
diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx
index 2913485..1ef4fa6 100644
--- a/canvas/source/vcl/textlayout.cxx
+++ b/canvas/source/vcl/textlayout.cxx
@@ -24,6 +24,7 @@
 
 #include <com/sun/star/rendering/CompositeOperation.hpp>
 #include <com/sun/star/rendering/TextDirection.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <vcl/metric.hxx>
 #include <vcl/virdev.hxx>
@@ -461,24 +462,20 @@ namespace vclcanvas
                           OffsetTransformer( aMatrix ) );
     }
 
-
-#define IMPLEMENTATION_NAME "VCLCanvas::TextLayout"
-#define SERVICE_NAME "com.sun.star.rendering.TextLayout"
-
     OUString SAL_CALL TextLayout::getImplementationName() throw( uno::RuntimeException )
     {
-        return OUString( IMPLEMENTATION_NAME );
+        return OUString( "VCLCanvas::TextLayout" );
     }
 
     sal_Bool SAL_CALL TextLayout::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException )
     {
-        return ServiceName == SERVICE_NAME;
+        return cppu::supportsService( this, ServiceName );
     }
 
     uno::Sequence< OUString > SAL_CALL TextLayout::getSupportedServiceNames()  throw( uno::RuntimeException )
     {
         uno::Sequence< OUString > aRet(1);
-        aRet[0] = OUString( SERVICE_NAME );
+        aRet[0] = "com.sun.star.rendering.TextLayout";
 
         return aRet;
     }
commit a2218b0d8b39e5018342b9085a3ec98941631952
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Tue Jan 14 12:27:09 2014 -0200

    fdo#54938: Convert svx and svl to cppu::supportsService...
    
    ...final season
    
    Change-Id: Ie51ac231def4a8a6e2681b81de7580798c95eed2

diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index b71d52b..b733602 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include <tools/color.hxx>
 #include <i18nlangtag/mslangid.hxx>
 #include <osl/mutex.hxx>
@@ -25,6 +24,7 @@
 
 #include <com/sun/star/util/Date.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 #include "numfmuno.hxx"
 #include <svl/numuno.hxx>
@@ -34,11 +34,6 @@
 
 using namespace com::sun::star;
 
-#define SERVICENAME_NUMBERFORMATTER "com.sun.star.util.NumberFormatter"
-#define SERVICENAME_NUMBERSETTINGS  "com.sun.star.util.NumberFormatSettings"
-#define SERVICENAME_NUMBERFORMATS   "com.sun.star.util.NumberFormats"
-#define SERVICENAME_NUMBERFORMAT    "com.sun.star.util.NumberFormatProperties"
-
 #define PROPERTYNAME_FMTSTR     "FormatString"
 #define PROPERTYNAME_LOCALE     "Locale"
 #define PROPERTYNAME_TYPE       "Type"
@@ -384,7 +379,7 @@ OUString SAL_CALL SvNumberFormatterServiceObj::getImplementationName()
 sal_Bool SAL_CALL SvNumberFormatterServiceObj::supportsService( const OUString& ServiceName )
     throw(uno::RuntimeException)
 {
-    return ServiceName.equalsAscii(SERVICENAME_NUMBERFORMATTER);
+    return cppu::supportsService( this, ServiceName );
 }
 
 uno::Sequence<OUString> SAL_CALL SvNumberFormatterServiceObj::getSupportedServiceNames()
@@ -392,7 +387,7 @@ uno::Sequence<OUString> SAL_CALL SvNumberFormatterServiceObj::getSupportedServic
 {
     uno::Sequence<OUString> aRet(1);
     OUString* pArray = aRet.getArray();
-    pArray[0] = SERVICENAME_NUMBERFORMATTER;
+    pArray[0] = "com.sun.star.util.NumberFormatter";
     return aRet;
 }
 
@@ -676,7 +671,7 @@ OUString SAL_CALL SvNumberFormatsObj::getImplementationName()
 sal_Bool SAL_CALL SvNumberFormatsObj::supportsService( const OUString& ServiceName )
     throw(uno::RuntimeException)
 {
-    return ServiceName.equalsAscii(SERVICENAME_NUMBERFORMATS);
+    return cppu::supportsService( this, ServiceName );
 }
 
 uno::Sequence<OUString> SAL_CALL SvNumberFormatsObj::getSupportedServiceNames()
@@ -684,7 +679,7 @@ uno::Sequence<OUString> SAL_CALL SvNumberFormatsObj::getSupportedServiceNames()
 {
     uno::Sequence<OUString> aRet(1);
     OUString* pArray = aRet.getArray();
-    pArray[0] = OUString(SERVICENAME_NUMBERFORMATS);
+    pArray[0] = "com.sun.star.util.NumberFormats";
     return aRet;
 }
 
@@ -933,7 +928,7 @@ OUString SAL_CALL SvNumberFormatObj::getImplementationName()
 sal_Bool SAL_CALL SvNumberFormatObj::supportsService( const OUString& ServiceName )
     throw(uno::RuntimeException)
 {
-    return ServiceName.equalsAscii(SERVICENAME_NUMBERFORMAT);
+    return cppu::supportsService( this, ServiceName );
 }
 
 uno::Sequence<OUString> SAL_CALL SvNumberFormatObj::getSupportedServiceNames()
@@ -941,7 +936,7 @@ uno::Sequence<OUString> SAL_CALL SvNumberFormatObj::getSupportedServiceNames()
 {
     uno::Sequence<OUString> aRet(1);
     OUString* pArray = aRet.getArray();
-    pArray[0] = SERVICENAME_NUMBERFORMAT;
+    pArray[0] = "com.sun.star.util.NumberFormatProperties";
     return aRet;
 }
 
@@ -1092,7 +1087,7 @@ OUString SAL_CALL SvNumberFormatSettingsObj::getImplementationName()
 sal_Bool SAL_CALL SvNumberFormatSettingsObj::supportsService( const OUString& ServiceName )
     throw(uno::RuntimeException)
 {
-    return ServiceName.equalsAscii(SERVICENAME_NUMBERSETTINGS);
+    return cppu::supportsService( this, ServiceName );
 }
 
 uno::Sequence<OUString> SAL_CALL SvNumberFormatSettingsObj::getSupportedServiceNames()
@@ -1100,7 +1095,7 @@ uno::Sequence<OUString> SAL_CALL SvNumberFormatSettingsObj::getSupportedServiceN
 {
     uno::Sequence<OUString> aRet(1);
     OUString* pArray = aRet.getArray();
-    pArray[0] = SERVICENAME_NUMBERSETTINGS;
+    pArray[0] = "com.sun.star.util.NumberFormatSettings";
     return aRet;
 }
 
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index c59e296..215758b 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -22,6 +22,7 @@
 
 #include <unotools/pathoptions.hxx>
 #include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
 #include <com/sun/star/registry/XSimpleRegistry.hpp>
@@ -1357,28 +1358,21 @@ void PasswordContainer::Notify()
     }
 }
 
-
 OUString SAL_CALL PasswordContainer::getImplementationName(  ) throw(uno::RuntimeException)
 {
     return impl_getStaticImplementationName();
 }
 
-
 sal_Bool SAL_CALL PasswordContainer::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
 {
-    if ( ServiceName.equalsAscii("com.sun.star.task.PasswordContainer") )
-        return sal_True;
-    else
-        return sal_False;
+    return cppu::supportsService( this,  ServiceName );
 }
 
-
 Sequence< OUString > SAL_CALL PasswordContainer::getSupportedServiceNames(  ) throw(uno::RuntimeException)
 {
     return impl_getStaticSupportedServiceNames();
 }
 
-
 Sequence< OUString > SAL_CALL PasswordContainer::impl_getStaticSupportedServiceNames(  ) throw(uno::RuntimeException)
 {
     Sequence< OUString > aRet(1);
@@ -1386,7 +1380,6 @@ Sequence< OUString > SAL_CALL PasswordContainer::impl_getStaticSupportedServiceN
     return aRet;
 }
 
-
 OUString SAL_CALL PasswordContainer::impl_getStaticImplementationName() throw(uno::RuntimeException)
 {
     return OUString("stardiv.svl.PasswordContainer");
diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
index 926affd..78cb151 100644
--- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
+++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
@@ -22,6 +22,7 @@
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
 #include <com/sun/star/awt/XWindow.hpp>
+#include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <toolkit/helper/convert.hxx>
@@ -362,33 +363,21 @@ OUString SvxPixelCtlAccessible::getImplementationName(  ) throw (uno::RuntimeExc
 {
     return OUString("SvxPixelCtlAccessible");
 }
-/*-- 04.02.2002 14:12:05---------------------------------------------------
-
-  -----------------------------------------------------------------------*/
-const sal_Char sAccessible[]          = "Accessible";
-const sal_Char sAccessibleContext[]   = "AccessibleContext";
-const sal_Char sAccessibleComponent[] = "AccessibleComponent";
 
 sal_Bool SvxPixelCtlAccessible::supportsService( const OUString& rServiceName )
     throw (uno::RuntimeException)
 {
-    return  rServiceName.equalsAsciiL( sAccessible         , sizeof(sAccessible         )-1 ) ||
-            rServiceName.equalsAsciiL( sAccessibleContext  , sizeof(sAccessibleContext  )-1 ) ||
-            rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );// ||
-//            rServiceName.equalsAsciiL( sAccessibleTable, sizeof(sAccessibleTable)-1 );
+    return cppu::supportsService( this, rServiceName );
 }
-/*-- 04.02.2002 14:12:05---------------------------------------------------
 
-  -----------------------------------------------------------------------*/
 uno::Sequence< OUString > SvxPixelCtlAccessible::getSupportedServiceNames(  )
     throw (uno::RuntimeException)
 {
     uno::Sequence< OUString > aRet(2);
     OUString* pArray = aRet.getArray();
-    pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible         ) );
-    pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext  ) );
-    pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) );
-//    pArray[3] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleTable) );
+    pArray[0] = "Accessible";
+    pArray[1] = "AccessibleContext";
+    pArray[2] = "AccessibleComponent";
     return aRet;
 }
 
@@ -951,7 +940,6 @@ void SAL_CALL SvxPixelCtlAccessibleChild::removeAccessibleEventListener( const u
 
 
 //=====  XServiceInfo  ========================================================
-
 OUString SAL_CALL SvxPixelCtlAccessibleChild::getImplementationName( void ) throw( RuntimeException )
 {
     return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxPixelCtlAccessibleChild" ) );
@@ -959,19 +947,16 @@ OUString SAL_CALL SvxPixelCtlAccessibleChild::getImplementationName( void ) thro
 
 sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::supportsService( const OUString& rServiceName ) throw( RuntimeException )
 {
-    return  rServiceName.equalsAsciiL( sAccessible         , sizeof(sAccessible         )-1 ) ||
-            rServiceName.equalsAsciiL( sAccessibleContext  , sizeof(sAccessibleContext  )-1 ) ||
-            rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );
-
+    return cppu::supportsService( this, rServiceName );
 }
 
 Sequence< OUString > SAL_CALL SvxPixelCtlAccessibleChild::getSupportedServiceNames( void ) throw( RuntimeException )
 {
     uno::Sequence< OUString > aRet(3);
     OUString* pArray = aRet.getArray();
-    pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible         ) );
-    pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext  ) );
-    pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) );
+    pArray[0] = "Accessible";
+    pArray[1] = "AccessibleContext";
+    pArray[2] = "AccessibleComponent";
     return aRet;
 }
 
diff --git a/svx/source/inc/unogalthemeprovider.hxx b/svx/source/inc/unogalthemeprovider.hxx
index 84980ab..9d8fa3c 100644
--- a/svx/source/inc/unogalthemeprovider.hxx
+++ b/svx/source/inc/unogalthemeprovider.hxx
@@ -20,7 +20,7 @@
 #ifndef INCLUDED_SVX_SOURCE_INC_UNOGALTHEMEPROVIDER_HXX
 #define INCLUDED_SVX_SOURCE_INC_UNOGALTHEMEPROVIDER_HXX
 
-#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/gallery/XGalleryThemeProvider.hpp>
@@ -29,8 +29,9 @@ class Gallery;
 
 namespace {
 
-class GalleryThemeProvider : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XInitialization,
-                                                             ::com::sun::star::gallery::XGalleryThemeProvider >
+class GalleryThemeProvider : public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XInitialization,
+                                                             ::com::sun::star::gallery::XGalleryThemeProvider,
+                                                             ::com::sun::star::lang::XServiceInfo >
 {
 public:
 
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 8685e7a..09c21e2 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -26,6 +26,7 @@
 
 #include <comphelper/string.hxx>
 
+#include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <svl/style.hxx>
 #include <svl/itemset.hxx>
@@ -867,30 +868,17 @@ Sequence< sal_Int8 > SAL_CALL Cell::getImplementationId(  ) throw (RuntimeExcept
     return pId->getImplementationId();
 }
 
-// -----------------------------------------------------------------------------
 // XServiceInfo
-// -----------------------------------------------------------------------------
-
 OUString SAL_CALL Cell::getImplementationName(  ) throw (RuntimeException)
 {
     return OUString( "com.sun.star.comp.svx.table.Cell" );
 }
 
-// -----------------------------------------------------------------------------
-
 sal_Bool SAL_CALL Cell::supportsService( const OUString& ServiceName ) throw (RuntimeException)
 {
-    if( ServiceName == "com.sun.star.table.cell" )
-        return sal_True;
-
-    if( ServiceName == "com.sun.star.drawing.cell" )
-        return sal_True;
-
-    return SvxUnoTextBase::supportsService( ServiceName );
+    return cppu::supportsService( this, ServiceName );
 }
 
-// -----------------------------------------------------------------------------
-
 Sequence< OUString > SAL_CALL Cell::getSupportedServiceNames(  ) throw (RuntimeException)
 {
     Sequence< OUString > aSeq( SvxUnoTextBase::getSupportedServiceNames() );
@@ -901,10 +889,7 @@ Sequence< OUString > SAL_CALL Cell::getSupportedServiceNames(  ) throw (RuntimeE
     return aSeq;
 }
 
-// -----------------------------------------------------------------------------
 // XLayoutConstrains
-// -----------------------------------------------------------------------------
-
 ::com::sun::star::awt::Size SAL_CALL Cell::getMinimumSize(  ) throw (RuntimeException)
 {
     return ::com::sun::star::awt::Size( getMinimumWidth(),  getMinimumHeight() );
diff --git a/svx/source/unodraw/UnoNamespaceMap.cxx b/svx/source/unodraw/UnoNamespaceMap.cxx
index b6add6a..361596d 100644
--- a/svx/source/unodraw/UnoNamespaceMap.cxx
+++ b/svx/source/unodraw/UnoNamespaceMap.cxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
 #include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <osl/diagnose.h>
 #include <osl/mutex.hxx>
 #include <svl/itempool.hxx>
@@ -281,10 +282,10 @@ OUString SAL_CALL NamespaceMap::getImplementationName(  )
     return NamespaceMap_getImplementationName();
 }
 
-sal_Bool SAL_CALL NamespaceMap::supportsService( const OUString& )
+sal_Bool SAL_CALL NamespaceMap::supportsService( const OUString& serviceName )
     throw(RuntimeException)
 {
-    return sal_True;
+    return cppu::supportsService( this, serviceName );
 }
 
 Sequence< OUString > SAL_CALL NamespaceMap::getSupportedServiceNames(  )
diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx
index c1afe3d..019654c 100644
--- a/svx/source/unodraw/unoctabl.cxx
+++ b/svx/source/unodraw/unoctabl.cxx
@@ -22,6 +22,7 @@
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <svx/xtable.hxx>
 
 using namespace ::com::sun::star;
@@ -72,14 +73,7 @@ SvxUnoColorTable::~SvxUnoColorTable() throw()
 
 sal_Bool SAL_CALL SvxUnoColorTable::supportsService( const  OUString& ServiceName ) throw(uno::RuntimeException)
 {
-    uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
-    const OUString * pArray = aSNL.getConstArray();
-
-    for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return sal_True;
-
-    return sal_False;
+    return cppu::supportsService( this, ServiceName );
 }
 
 OUString SAL_CALL SvxUnoColorTable::getImplementationName() throw( uno::RuntimeException )
diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx
index 6923052..7017871 100644
--- a/svx/source/unogallery/unogaltheme.cxx
+++ b/svx/source/unogallery/unogaltheme.cxx
@@ -32,6 +32,7 @@
 #include <vcl/svapp.hxx>
 #include <unotools/pathoptions.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 using namespace ::com::sun::star;
 
@@ -89,39 +90,24 @@ uno::Sequence< OUString > GalleryTheme::getSupportedServiceNames_Static()
     return aSeq;
 }
 
-// ------------------------------------------------------------------------------
-
 OUString SAL_CALL GalleryTheme::getImplementationName()
     throw( uno::RuntimeException )
 {
     return getImplementationName_Static();
 }
 
-// ------------------------------------------------------------------------------
-
 sal_Bool SAL_CALL GalleryTheme::supportsService( const OUString& ServiceName )
     throw( uno::RuntimeException )
 {
-    uno::Sequence< OUString >    aSNL( getSupportedServiceNames() );
-    const OUString*              pArray = aSNL.getConstArray();
-
-    for( int i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return true;
-
-    return false;
+    return cppu::supportsService( this, ServiceName );
 }
 
-// ------------------------------------------------------------------------------
-
 uno::Sequence< OUString > SAL_CALL GalleryTheme::getSupportedServiceNames()
     throw( uno::RuntimeException )
 {
     return getSupportedServiceNames_Static();
 }
 
-// ------------------------------------------------------------------------------
-
 uno::Sequence< uno::Type > SAL_CALL GalleryTheme::getTypes()
     throw(uno::RuntimeException)
 {
diff --git a/svx/source/unogallery/unogaltheme.hxx b/svx/source/unogallery/unogaltheme.hxx
index c2d0689..5359d14 100644
--- a/svx/source/unogallery/unogaltheme.hxx
+++ b/svx/source/unogallery/unogaltheme.hxx
@@ -22,7 +22,7 @@
 
 #include <list>
 
-#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
 #include <svl/lstner.hxx>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/gallery/XGalleryTheme.hpp>
@@ -38,7 +38,9 @@ namespace unogallery {
 // - GalleryTheme -
 // ----------------
 
-class GalleryTheme : public ::cppu::WeakImplHelper1< ::com::sun::star::gallery::XGalleryTheme >,
+class GalleryTheme : public ::cppu::WeakImplHelper2<
+                                                        ::com::sun::star::gallery::XGalleryTheme,
+                                                        ::com::sun::star::lang::XServiceInfo >,
                      public SfxListener
 {
     friend class ::unogallery::GalleryItem;
diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx
index 2400573..7878e90 100644
--- a/svx/source/unogallery/unogalthemeprovider.cxx
+++ b/svx/source/unogallery/unogalthemeprovider.cxx
@@ -25,6 +25,7 @@
 #include <vcl/svapp.hxx>
 #include <unotools/pathoptions.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/gallery/XGalleryTheme.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 
@@ -38,37 +39,22 @@ GalleryThemeProvider::GalleryThemeProvider() :
     mpGallery = ::Gallery::GetGalleryInstance();
 }
 
-// ------------------------------------------------------------------------------
-
 GalleryThemeProvider::~GalleryThemeProvider()
 {
 }
 
-// ------------------------------------------------------------------------------
-
 OUString SAL_CALL GalleryThemeProvider::getImplementationName()
     throw( uno::RuntimeException )
 {
     return OUString( "com.sun.star.comp.gallery.GalleryThemeProvider" );
 }
 
-// ------------------------------------------------------------------------------
-
 sal_Bool SAL_CALL GalleryThemeProvider::supportsService( const OUString& ServiceName )
     throw( uno::RuntimeException )
 {
-    uno::Sequence< OUString >    aSNL( getSupportedServiceNames() );
-    const OUString*              pArray = aSNL.getConstArray();
-
-    for( int i = 0; i < aSNL.getLength(); i++ )
-        if( pArray[i] == ServiceName )
-            return true;
-
-    return false;
+    return cppu::supportsService( this, ServiceName );
 }
 
-// ------------------------------------------------------------------------------
-
 uno::Sequence< OUString > SAL_CALL GalleryThemeProvider::getSupportedServiceNames()
     throw( uno::RuntimeException )
 {
@@ -77,8 +63,6 @@ uno::Sequence< OUString > SAL_CALL GalleryThemeProvider::getSupportedServiceName
     return aSeq;
 }
 
-// ------------------------------------------------------------------------------
-
 uno::Sequence< uno::Type > SAL_CALL GalleryThemeProvider::getTypes()
     throw(uno::RuntimeException)
 {
@@ -106,8 +90,6 @@ uno::Sequence< sal_Int8 > SAL_CALL GalleryThemeProvider::getImplementationId()
     return theGalleryThemeProviderImplementationId::get().getSeq();
 }
 
-// ------------------------------------------------------------------------------
-
 void SAL_CALL GalleryThemeProvider::initialize( const uno::Sequence< uno::Any >& rArguments )
     throw ( uno::Exception, uno::RuntimeException )
 {
commit f32f8285966a0455a7c0db71e196e5ea92390329
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Wed Jan 15 17:19:29 2014 +0100

    sfx: TEST_HANDLERS not defined
    
    Change-Id: If02c029114e9531951b18abeb9d0afd0a18ceca3

diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index b47fb0b..778ec14 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -1693,77 +1693,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
     rArgs = aSequ;
 }
 
-#ifdef TEST_HANDLERS
-#include <cppuhelper/implbase2.hxx>
-
-#include <com/sun/star/awt/XKeyHandler.hpp>
-#include <com/sun/star/awt/XMouseClickHandler.hpp>
-
-class TestKeyHandler: public ::cppu::WeakImplHelper2
-<
-    com::sun::star::awt::XKeyHandler,
-    com::sun::star::lang::XServiceInfo
->
-{
-public:
-    TestKeyHandler( const com::sun::star::uno::Reference < lang::XMultiServiceFactory >& ){}
-
-    SFX_DECL_XSERVICEINFO
-    virtual sal_Bool SAL_CALL keyPressed( const awt::KeyEvent& aEvent ) throw (uno::RuntimeException);
-    virtual sal_Bool SAL_CALL keyReleased( const awt::KeyEvent& aEvent ) throw (uno::RuntimeException);
-    virtual void SAL_CALL disposing( const lang::EventObject& Source)
-        throw (uno::RuntimeException);
-};
-
-class TestMouseClickHandler: public ::cppu::WeakImplHelper2
-<
-    com::sun::star::awt::XMouseClickHandler,
-    com::sun::star::lang::XServiceInfo
->
-{
-public:
-    TestMouseClickHandler( const com::sun::star::uno::Reference < lang::XMultiServiceFactory >& ){}
-
-    SFX_DECL_XSERVICEINFO
-    virtual sal_Bool SAL_CALL mousePressed( const awt::MouseEvent& e ) throw (uno::RuntimeException);
-    virtual sal_Bool SAL_CALL mouseReleased( const awt::MouseEvent& e ) throw (uno::RuntimeException);
-    virtual void SAL_CALL disposing( const lang::EventObject& Source)
-        throw (uno::RuntimeException);
-};
-
-sal_Bool SAL_CALL TestKeyHandler::keyPressed( const awt::KeyEvent& aEvent ) throw (uno::RuntimeException)
-{
-    return sal_False;
-}
-
-sal_Bool SAL_CALL TestKeyHandler::keyReleased( const awt::KeyEvent& aEvent ) throw (uno::RuntimeException)
-{
-    return sal_False;
-}
-
-void SAL_CALL TestKeyHandler::disposing( const lang::EventObject& Source) throw (uno::RuntimeException)
-{
-}
-
-sal_Bool SAL_CALL TestMouseClickHandler::mousePressed( const awt::MouseEvent& e ) throw (uno::RuntimeException)
-{
-    return sal_False;
-}
-
-sal_Bool SAL_CALL TestMouseClickHandler::mouseReleased( const awt::MouseEvent& e ) throw (uno::RuntimeException)
-{
-    return sal_False;
-}
-
-void SAL_CALL TestMouseClickHandler::disposing( const lang::EventObject& Source) throw (uno::RuntimeException)
-{
-}
-
-SFX_IMPL_XSERVICEINFO( TestKeyHandler, "com.sun.star.task.Job", "com.sun.star.comp.Office.KeyHandler");
-SFX_IMPL_XSERVICEINFO( TestMouseClickHandler, "com.sun.star.task.Job", "com.sun.star.comp.Office.MouseClickHandler");
-SFX_IMPL_SINGLEFACTORY( TestKeyHandler );
-SFX_IMPL_SINGLEFACTORY( TestMouseClickHandler );
-#endif
 // -----------------------------------------------------------------------
 
 extern "C" {
@@ -1791,10 +1720,6 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory(
         //      Write no ";" at end of line and dont forget "else" ! (see macro)
         //=============================================================================
         IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
-#ifdef TEST_HANDLERS
-        IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler )
-        IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler )
-#endif
 
         // Factory is valid - service was found.
 
commit de74b8c58ac516fe5f083a88cbcb89fc3ccc5eef
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Wed Jan 15 17:16:15 2014 +0100

    sfx: Use constructor feature for BackingComp.
    
    Change-Id: Ia461b8315ddd07adcb5609aefa85385db17ebba4

diff --git a/sfx2/inc/backingcomp.hxx b/sfx2/inc/backingcomp.hxx
deleted file mode 100644
index 7d1b38e..0000000
--- a/sfx2/inc/backingcomp.hxx
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SFX2_INC_BACKINGCOMP_HXX
-#define INCLUDED_SFX2_INC_BACKINGCOMP_HXX
-
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/awt/XKeyListener.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-
-#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-
-#include <cppuhelper/weak.hxx>
-
-//__________________________________________
-// definition
-
-//__________________________________________
-/**
-    implements the backing component.
-
-    This component is a special one, which doesn't provide a controller
-    nor a model. It supports the following features:
-        - Drag & Drop
-        - Key Accelerators
-        - Simple Menu
-        - Progress Bar
-        - Background
- */
-class BackingComp : public  css::lang::XTypeProvider
-                  , public  css::lang::XServiceInfo
-                  , public  css::lang::XInitialization
-                  , public  css::frame::XController  // => XComponent
-                  , public  css::awt::XKeyListener // => XEventListener
-                  , public css::frame::XDispatchProvider
-                  , public css::frame::XDispatch
-                  , public  ::cppu::OWeakObject
-{
-    //______________________________________
-    // member
-
-    private:
-        /** the global uno service manager.
-            Must be used to create own needed services. */
-        css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
-        /** reference to the component window. */
-        css::uno::Reference< css::awt::XWindow > m_xWindow;
-
-        /** the owner frame of this component. */
-        css::uno::Reference< css::frame::XFrame > m_xFrame;
-
-    //______________________________________
-    // interface
-
-    public:
-
-                 BackingComp( const css::uno::Reference< css::uno::XComponentContext >& xContext );
-        virtual ~BackingComp(                                                                    );
-
-        // XInterface
-        virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException);
-        virtual void          SAL_CALL acquire       (                             ) throw(                          );
-        virtual void          SAL_CALL release       (                             ) throw(                          );
-
-        // XTypeProvide
-        virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes           () throw(css::uno::RuntimeException);
-        virtual css::uno::Sequence< sal_Int8 >       SAL_CALL getImplementationId() throw(css::uno::RuntimeException);
-
-        // XServiceInfo
-        virtual OUString                       SAL_CALL getImplementationName   (                                     ) throw(css::uno::RuntimeException);
-        virtual sal_Bool                              SAL_CALL supportsService         ( const OUString& sServiceName ) throw(css::uno::RuntimeException);
-        virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(                                     ) throw(css::uno::RuntimeException);
-
-        // XInitialization
-        virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArgs ) throw(css::uno::Exception, css::uno::RuntimeException);
-
-        // XController
-        virtual void                                      SAL_CALL attachFrame    ( const css::uno::Reference< css::frame::XFrame >& xFrame   ) throw(css::uno::RuntimeException);
-        virtual sal_Bool                                  SAL_CALL attachModel    ( const css::uno::Reference< css::frame::XModel >& xModel   ) throw(css::uno::RuntimeException);
-        virtual sal_Bool                                  SAL_CALL suspend        (       sal_Bool                                   bSuspend ) throw(css::uno::RuntimeException);
-        virtual css::uno::Any                             SAL_CALL getViewData    (                                                           ) throw(css::uno::RuntimeException);
-        virtual void                                      SAL_CALL restoreViewData( const css::uno::Any&                             aData    ) throw(css::uno::RuntimeException);
-        virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel       (                                                           ) throw(css::uno::RuntimeException);
-        virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame       (                                                           ) throw(css::uno::RuntimeException);
-
-        // XKeyListener
-        virtual void SAL_CALL keyPressed ( const css::awt::KeyEvent& aEvent ) throw(css::uno::RuntimeException);
-        virtual void SAL_CALL keyReleased( const css::awt::KeyEvent& aEvent ) throw(css::uno::RuntimeException);
-
-        // XEventListener
-        virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException);
-
-        // XComponent
-        virtual void SAL_CALL dispose            (                                                                   ) throw(css::uno::RuntimeException);
-        virtual void SAL_CALL addEventListener   ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException);
-        virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException);
-
-        // XDispatchProvider
-        virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const OUString& sTargetFrameName , sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException );
-        virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions    ) throw( css::uno::RuntimeException );
-
-        // XDispatch
-        virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException );
-        virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException );
-        virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException );
-
-    //______________________________________
-    // helper
-
-    public:
-
-        static css::uno::Sequence< OUString >                   SAL_CALL impl_getStaticSupportedServiceNames(                                                                     );
-        static OUString                                         SAL_CALL impl_getStaticImplementationName   (                                                                     );
-        static css::uno::Reference< css::uno::XInterface >             SAL_CALL impl_createInstance                ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ) throw( css::uno::Exception );
-        static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory                 ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
-};
-
-#endif // INCLUDED_SFX2_INC_BACKINGCOMP_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 5bad955..b47fb0b 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -21,7 +21,6 @@
 #pragma warning( disable : 4290 )
 #endif
 
-#include "backingcomp.hxx"
 #include "eventsupplier.hxx"
 #include "fltoptint.hxx"
 #include "objshimp.hxx"
@@ -1791,7 +1790,6 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory(
         //  !!! ATTENTION !!!
         //      Write no ";" at end of line and dont forget "else" ! (see macro)
         //=============================================================================
-        IF_NAME_CREATECOMPONENTFACTORY( BackingComp )
         IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
 #ifdef TEST_HANDLERS
         IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler )
diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx
index 5e357e3..6052c96 100644
--- a/sfx2/source/dialog/backingcomp.cxx
+++ b/sfx2/source/dialog/backingcomp.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include "backingcomp.hxx"
-
 #include "backingwindow.hxx"
 
 #include <helpid.hrc>
@@ -33,14 +31,23 @@
 #include <com/sun/star/awt/KeyModifier.hpp>
 #include <com/sun/star/frame/XLayoutManager.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
-
-#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XKeyListener.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/factory.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <vcl/keycod.hxx>
 #include <vcl/wrkwin.hxx>
 #include <vcl/svapp.hxx>
+#include <rtl/ref.hxx>
 #include <rtl/ustrbuf.hxx>
 
 #include <svl/solar.hrc>
@@ -50,15 +57,96 @@
 
 #include <unotools/bootstrap.hxx>
 
-const char SERVICENAME_FRAMECONTROLLER[] = "com.sun.star.frame.Controller";
-const char IMPLEMENTATIONNAME_STARTMODULE[] = "com.sun.star.comp.sfx2.BackingComp";
+
+namespace {
+
 const char FRAME_PROPNAME_LAYOUTMANAGER[] = "LayoutManager";
 const char HID_BACKINGWINDOW[] = "FWK_HID_BACKINGWINDOW";
 const char SPECIALTARGET_MENUBAR[] = "_menubar";
 
-//_______________________________________________
-
-//_______________________________________________
+/**
+    implements the backing component.
+
+    This component is a special one, which doesn't provide a controller
+    nor a model. It supports the following features:
+        - Drag & Drop
+        - Key Accelerators
+        - Simple Menu
+        - Progress Bar
+        - Background
+ */
+class BackingComp : public  css::lang::XTypeProvider
+                  , public  css::lang::XServiceInfo
+                  , public  css::lang::XInitialization
+                  , public  css::frame::XController  // => XComponent
+                  , public  css::awt::XKeyListener // => XEventListener
+                  , public css::frame::XDispatchProvider
+                  , public css::frame::XDispatch
+                  , public  ::cppu::OWeakObject
+{
+private:
+    /** the global uno service manager.
+        Must be used to create own needed services. */
+    css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+    /** reference to the component window. */
+    css::uno::Reference< css::awt::XWindow > m_xWindow;
+
+    /** the owner frame of this component. */
+    css::uno::Reference< css::frame::XFrame > m_xFrame;
+
+public:
+
+             BackingComp( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+    virtual ~BackingComp(                                                                    );
+
+    // XInterface
+    virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException);
+    virtual void          SAL_CALL acquire       (                             ) throw(                          );
+    virtual void          SAL_CALL release       (                             ) throw(                          );
+
+    // XTypeProvide
+    virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes           () throw(css::uno::RuntimeException);
+    virtual css::uno::Sequence< sal_Int8 >       SAL_CALL getImplementationId() throw(css::uno::RuntimeException);
+
+    // XServiceInfo
+    virtual OUString                       SAL_CALL getImplementationName   (                                     ) throw(css::uno::RuntimeException);
+    virtual sal_Bool                              SAL_CALL supportsService         ( const OUString& sServiceName ) throw(css::uno::RuntimeException);
+    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(                                     ) throw(css::uno::RuntimeException);
+
+    // XInitialization
+    virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArgs ) throw(css::uno::Exception, css::uno::RuntimeException);
+
+    // XController
+    virtual void SAL_CALL attachFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw(css::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL attachModel( const css::uno::Reference< css::frame::XModel >& xModel ) throw(css::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) throw(css::uno::RuntimeException);
+    virtual css::uno::Any SAL_CALL getViewData() throw(css::uno::RuntimeException);
+    virtual void SAL_CALL restoreViewData( const css::uno::Any& aData ) throw(css::uno::RuntimeException);
+    virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel() throw(css::uno::RuntimeException);
+    virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() throw(css::uno::RuntimeException);
+
+    // XKeyListener
+    virtual void SAL_CALL keyPressed ( const css::awt::KeyEvent& aEvent ) throw(css::uno::RuntimeException);
+    virtual void SAL_CALL keyReleased( const css::awt::KeyEvent& aEvent ) throw(css::uno::RuntimeException);
+
+    // XEventListener
+    virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException);
+
+    // XComponent
+    virtual void SAL_CALL dispose            (                                                                   ) throw(css::uno::RuntimeException);
+    virtual void SAL_CALL addEventListener   ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException);
+    virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException);
+
+    // XDispatchProvider
+    virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const OUString& sTargetFrameName , sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException );
+    virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions    ) throw( css::uno::RuntimeException );
+
+    // XDispatch
+    virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException );
+    virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException );
+    virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException );
+};
 
 BackingComp::BackingComp( const css::uno::Reference< css::uno::XComponentContext >& xContext )
     : m_xContext(xContext)
@@ -227,101 +315,21 @@ css::uno::Sequence< sal_Int8 > SAL_CALL BackingComp::getImplementationId()
     return pID->getImplementationId();
 }
 
-//_______________________________________________
-
-/** returns a static implementation name for this UNO service.
-
-    Because this value is needed at different places and our class is used
-    by some generic macros too, we have to use a static impl method for that!
-
-    @see impl_getStaticImplementationName()
-    @see IMPLEMENTATIONNAME
-
-    @return The implementation name of this class.
-*/
-
 OUString SAL_CALL BackingComp::getImplementationName()
     throw(css::uno::RuntimeException)
 {
-    return impl_getStaticImplementationName();
+    return OUString("com.sun.star.comp.sfx2.BackingComp");
 }
 
-//_______________________________________________
-
-/** returns information about supported services.
-
-    Because this value is needed at different places and our class is used
-    by some generic macros too, we have to use a static impl method for that!
-
-    @see impl_getStaticSupportedServiceNames()
-    @see SERVICENAME
-
-    @return <TRUE/> if the queried service is supported;
-            <br><FALSE/> otherwise.
-*/
-
 sal_Bool SAL_CALL BackingComp::supportsService( /*IN*/ const OUString& sServiceName )
     throw(css::uno::RuntimeException)
 {
-    return (
-            sServiceName.equals("com.sun.star.frame.StartModule") ||
-            sServiceName.equals(SERVICENAME_FRAMECONTROLLER) ||
-            sServiceName.equals("com.sun.star.frame.ProtocolHandler")
-           );
+    return cppu::supportsService(this, sServiceName);
 }
 
-//_______________________________________________
-
-/** returns collection of supported services.
-
-    Because this value is needed at different places and our class is used
-    by some generic macros too, we have to use a static impl method for that!
-
-    @see impl_getStaticSupportedServiceNames()
-    @see SERVICENAME
-
-    @return A list of all supported uno service names.
-*/
-
 css::uno::Sequence< OUString > SAL_CALL BackingComp::getSupportedServiceNames()
     throw(css::uno::RuntimeException)
 {
-    return impl_getStaticSupportedServiceNames();
-}
-
-//_______________________________________________
-
-/** returns static implementation name.
-
-    Because this value is needed at different places and our class is used
-    by some generic macros too, we have to use a static impl method for that!
-
-    @see impl_getStaticSupportedServiceNames()
-    @see SERVICENAME
-
-    @return The implementation name of this class.
-*/
-
-OUString BackingComp::impl_getStaticImplementationName()
-{
-    return OUString( IMPLEMENTATIONNAME_STARTMODULE );
-}
-
-//_______________________________________________
-
-/** returns static list of supported service names.
-
-    Because this value is needed at different places and our class is used
-    by some generic macros too, we have to use a static impl method for that!
-
-    @see impl_getStaticSupportedServiceNames()
-    @see SERVICENAME
-
-    @return A list of all supported uno service names.
-*/
-
-css::uno::Sequence< OUString > BackingComp::impl_getStaticSupportedServiceNames()
-{
     css::uno::Sequence< OUString > lNames(2);
     lNames[0] = "com.sun.star.frame.StartModule";
     lNames[1] = "com.sun.star.frame.ProtocolHandler";
@@ -330,56 +338,6 @@ css::uno::Sequence< OUString > BackingComp::impl_getStaticSupportedServiceNames(
 
 //_______________________________________________
 
-/** returns a new instance of this class.
-
-    This factory method is registered inside the UNO runtime
-    and will be called for every createInstance() request from outside,
-    which wish to use this service.
-
-    @param  xSMGR
-                reference to the uno service manager, which call us
-                We use it too, to set it at the new created instance.
-
-    @return A new instance as uno reference.
-*/
-
-css::uno::Reference< css::uno::XInterface > SAL_CALL BackingComp::impl_createInstance( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR )
-    throw(css::uno::Exception)
-{
-    BackingComp* pObject = new BackingComp(comphelper::getComponentContext(xSMGR));
-    return css::uno::Reference< css::uno::XInterface >(static_cast< ::cppu::OWeakObject* >(pObject), css::uno::UNO_QUERY);
-}
-
-//_______________________________________________
-
-/** returns a new factory instance for instances of this class.
-
-    It uses a helper class of the cppuhelper project as factory.
-    It will be initialized with all necessary information and
-    will be able afterwards to create instance of this class.
-    This factory call us back inside our method impl_createInstance().
-    So we can create and initialize ourself. Only filtering of creation
-    requests will be done by this factory.
-
-    @param  xSMGR
-                reference to the uno service manager, which call us
-
-    @return A new instance of our factory.
-*/
-
-css::uno::Reference< css::lang::XSingleServiceFactory > BackingComp::impl_createFactory( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR )
-{
-    css::uno::Reference< css::lang::XSingleServiceFactory > xReturn(
-        cppu::createSingleFactory(
-            xSMGR,
-            BackingComp::impl_getStaticImplementationName(),
-            BackingComp::impl_createInstance,
-            BackingComp::impl_getStaticSupportedServiceNames()));
-    return xReturn;
-}
-
-//_______________________________________________
-
 /**
     attach this component to a target frame.
 
@@ -848,4 +806,16 @@ void SAL_CALL BackingComp::removeStatusListener( const css::uno::Reference< css:
 {
 }
 
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_sfx2_BackingComp_get_implementation(
+    css::uno::XComponentContext *context,
+    css::uno::Sequence<css::uno::Any> const &)
+{
+    rtl::Reference<BackingComp> x(new BackingComp(context));
+    x->acquire();
+    return static_cast<cppu::OWeakObject *>(x.get());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component
index 09ab132..a66335e 100644
--- a/sfx2/util/sfx.component
+++ b/sfx2/util/sfx.component
@@ -19,7 +19,8 @@
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     prefix="sfx" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.sfx2.BackingComp">
+  <implementation name="com.sun.star.comp.sfx2.BackingComp"
+      constructor="com_sun_star_comp_sfx2_BackingComp_get_implementation">
     <service name="com.sun.star.frame.StartModule"/>
     <service name="com.sun.star.frame.ProtocolHandler"/>
   </implementation>
commit 2b30c5057800e39fb6129be4b175ee10bf5f0e5e
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Wed Jan 15 16:48:16 2014 +0100

    sfx: Constructor feature for two more implementations.
    
    Change-Id: Icd387ff97c5df3cea9b20b0b893616812457e493

diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index bb21a6c..5bad955 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -22,7 +22,6 @@
 #endif
 
 #include "backingcomp.hxx"
-#include "SfxDocumentMetaData.hxx"
 #include "eventsupplier.hxx"
 #include "fltoptint.hxx"
 #include "objshimp.hxx"
@@ -1798,22 +1797,6 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory(
         IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler )
         IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler )
 #endif
-        if ( ::comp_SfxDocumentMetaData::_getImplementationName().equals(
-                 OUString::createFromAscii( pImplementationName ) ) )
-        {
-            xFactory = ::cppu::createSingleComponentFactory(
-            ::comp_SfxDocumentMetaData::_create,
-            ::comp_SfxDocumentMetaData::_getImplementationName(),
-            ::comp_SfxDocumentMetaData::_getSupportedServiceNames());
-        }
-        if ( ::comp_CompatWriterDocProps::_getImplementationName().equals(
-                 OUString::createFromAscii( pImplementationName ) ) )
-        {
-            xFactory = ::cppu::createSingleComponentFactory(
-            ::comp_CompatWriterDocProps::_create,
-            ::comp_CompatWriterDocProps::_getImplementationName(),
-            ::comp_CompatWriterDocProps::_getSupportedServiceNames());
-        }
 
         // Factory is valid - service was found.
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list