Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


On Fri, Nov 08, 2013 at 08:57:31AM +0100, Stephan Bergmann wrote:
Ouch.  I must admit I at least didn't carefully inspect all of the
supportsService implementations cleaned up in
<https://bugs.freedesktop.org/show_bug.cgi?id=54938> "Adapt
supportsService implementations to cppu::supportsService" for this
gotcha of deliberate incompatibility between supportsService and
getSupportedServiceNames.

Would it not be better here to change
OShape::getSupportedServiceNames instead, to also report
m_sServiceName?

On the face of it, it sounds reasonable.

I tried to do it with the attached patch.

However, rpt_component_getFactory in file
reportdesign/source/core/api/services.cxx wants to use
OShape::getSupportedServiceNames_Static

I'm not sure for what exactly; but I expect there it wants a static
function there (no "this" pointer).

So we are making getSupportedServiceNames and supportsService
compatible, but we are making getSupportedServiceNames incompatible
with getSupportedServiceNames_Static.

What are the consequences of that? Which incompatibility is
preferable? I don't know. Do you have an opinion on that?

On 11/08/2013 03:10 AM, Lionel Elie Mamane wrote:
commit e7fad6da680631f82684d4f248ab77d53caa4189
Author: Lionel Elie Mamane <lionel@mamane.lu>
Date:   Fri Nov 8 03:06:09 2013 +0100

     fdo#71130 pretend to support service m_sServiceName

     Which was the case before, and was probably erroneously changed in
     commit 196f980012739d94654e6863b85b2e49f7e1a1e5
         fdo#54938: Replace existsValue for cppu::supportsService

     Change-Id: I20323bba1105d1844c79a5a0ad3c9e133a9d0d05

diff --git a/reportdesign/source/core/api/Shape.cxx b/reportdesign/source/core/api/Shape.cxx
index 47270d4..d22ed65 100644
--- a/reportdesign/source/core/api/Shape.cxx
+++ b/reportdesign/source/core/api/Shape.cxx
@@ -151,7 +151,7 @@ uno::Sequence< OUString > SAL_CALL OShape::getSupportedServiceNames(  ) 
throw(un
  sal_Bool SAL_CALL OShape::supportsService(const OUString& ServiceName) throw( 
uno::RuntimeException )
  {

-    return cppu::supportsService(this, ServiceName);
+    return m_sServiceName == ServiceName || cppu::supportsService(this, ServiceName);
  }
  // -----------------------------------------------------------------------------
  // XReportComponent
diff --git a/reportdesign/source/core/api/Shape.cxx b/reportdesign/source/core/api/Shape.cxx
index d22ed65..e3a1f0e 100644
--- a/reportdesign/source/core/api/Shape.cxx
+++ b/reportdesign/source/core/api/Shape.cxx
@@ -128,14 +128,7 @@ OUString SAL_CALL OShape::getImplementationName(  ) 
throw(uno::RuntimeException)
 {
     return getImplementationName_Static();
 }
-//--------------------------------------------------------------------------
-uno::Sequence< OUString > OShape::getSupportedServiceNames_Static(  ) throw(uno::RuntimeException)
-{
-    uno::Sequence< OUString > aServices(1);
-    aServices.getArray()[0] = SERVICE_SHAPE;
 
-    return aServices;
-}
 //------------------------------------------------------------------------------
 uno::Reference< uno::XInterface > OShape::create(uno::Reference< uno::XComponentContext > const & 
xContext)
 {
@@ -145,13 +138,17 @@ uno::Reference< uno::XInterface > OShape::create(uno::Reference< 
uno::XComponent
 //--------------------------------------------------------------------------
 uno::Sequence< OUString > SAL_CALL OShape::getSupportedServiceNames(  ) 
throw(uno::RuntimeException)
 {
-    return getSupportedServiceNames_Static();
+    uno::Sequence< OUString > aServices(2);
+    aServices.getArray()[0] = SERVICE_SHAPE;
+    aServices.getArray()[1] = m_sServiceName;
+
+    return aServices;
 }
 //------------------------------------------------------------------------------
 sal_Bool SAL_CALL OShape::supportsService(const OUString& ServiceName) throw( 
uno::RuntimeException )
 {
 
-    return m_sServiceName == ServiceName || cppu::supportsService(this, ServiceName);
+    return cppu::supportsService(this, ServiceName);
 }
 // -----------------------------------------------------------------------------
 // XReportComponent
diff --git a/reportdesign/source/core/inc/Shape.hxx b/reportdesign/source/core/inc/Shape.hxx
index 463843f..2298fc1 100644
--- a/reportdesign/source/core/inc/Shape.hxx
+++ b/reportdesign/source/core/inc/Shape.hxx
@@ -89,7 +89,6 @@ namespace reportdesign
         virtual OUString SAL_CALL getImplementationName(  ) 
throw(::com::sun::star::uno::RuntimeException);
         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) 
throw(::com::sun::star::uno::RuntimeException);
 
-        static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) 
throw( ::com::sun::star::uno::RuntimeException );
         static OUString getImplementationName_Static(void) throw( 
::com::sun::star::uno::RuntimeException );
         static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
             create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > 
const & xContext);

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.