[Libreoffice-commits] core.git: slideshow/source slideshow/util

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 16 10:19:24 UTC 2020


 slideshow/source/engine/opengl/TransitionerImpl.cxx |   39 ++++++++++---------
 slideshow/source/engine/opengl/ogltrans.component   |    5 +-
 slideshow/source/engine/slideshowimpl.cxx           |   41 +++++++++++++-------
 slideshow/util/slideshow.component                  |    5 +-
 4 files changed, 55 insertions(+), 35 deletions(-)

New commits:
commit 6dbfba16d86b81419d833c6ab2c4904b67770069
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 16 09:31:52 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 16 12:18:44 2020 +0200

    slideshow: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: I0b0a74ec8133de55664e471fcf13d7c66f882b12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98871
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx
index b9aa8326a438..41a95994062e 100644
--- a/slideshow/source/engine/opengl/TransitionerImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx
@@ -46,15 +46,14 @@
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
 #include <com/sun/star/geometry/IntegerSize2D.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
 
 #include <cppuhelper/compbase.hxx>
 #include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <rtl/ref.hxx>
 #include <sal/log.hxx>
 
-#include <comphelper/servicedecl.hxx>
-
 #include <canvas/canvastools.hxx>
 
 #include <tools/diagnose_ex.h>
@@ -1154,15 +1153,29 @@ OGLTransitionerImpl::OGLTransitionerImpl()
 {
 }
 
-typedef cppu::WeakComponentImplHelper<presentation::XTransitionFactory> OGLTransitionFactoryImplBase;
+typedef cppu::WeakComponentImplHelper<presentation::XTransitionFactory, lang::XServiceInfo> OGLTransitionFactoryImplBase;
 
 class OGLTransitionFactoryImpl : private cppu::BaseMutex, public OGLTransitionFactoryImplBase
 {
 public:
-    explicit OGLTransitionFactoryImpl( const uno::Reference< uno::XComponentContext >& ) :
+    explicit OGLTransitionFactoryImpl() :
         OGLTransitionFactoryImplBase(m_aMutex)
     {}
 
+    // XServiceInfo
+    virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override
+    {
+        return { "com.sun.star.presentation.TransitionFactory" };
+    }
+    virtual OUString SAL_CALL getImplementationName() override
+    {
+        return "com.sun.star.comp.presentation.OGLTransitionFactory";
+    }
+    virtual sal_Bool SAL_CALL supportsService(const OUString& aServiceName) override
+    {
+        return cppu::supportsService(this, aServiceName);
+    }
+
     // XTransitionFactory
     virtual sal_Bool SAL_CALL hasTransition( sal_Int16 transitionType, sal_Int16 transitionSubType ) override
     {
@@ -1305,18 +1318,10 @@ public:
 
 }
 
-namespace sdecl = comphelper::service_decl;
- const sdecl::ServiceDecl OGLTransitionFactoryDecl(
-     sdecl::class_<OGLTransitionFactoryImpl>(),
-    "com.sun.star.comp.presentation.OGLTransitionFactory",
-    "com.sun.star.presentation.TransitionFactory" );
-
-// The C shared lib entry points
-extern "C"
-SAL_DLLPUBLIC_EXPORT void* ogltrans_component_getFactory( char const* pImplName,
-                                         void*, void* )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+slideshow_OGLTransitionFactoryImpl_get_implementation(
+    css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    return sdecl::component_getFactoryHelper( pImplName, {&OGLTransitionFactoryDecl} );
+    return cppu::acquire(new OGLTransitionFactoryImpl());
 }
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/engine/opengl/ogltrans.component b/slideshow/source/engine/opengl/ogltrans.component
index 20e5e0f07a6c..5ce59a80e335 100644
--- a/slideshow/source/engine/opengl/ogltrans.component
+++ b/slideshow/source/engine/opengl/ogltrans.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="ogltrans" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.presentation.OGLTransitionFactory">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.presentation.OGLTransitionFactory"
+    constructor="slideshow_OGLTransitionFactoryImpl_get_implementation">
     <service name="com.sun.star.presentation.TransitionFactory"/>
   </implementation>
 </component>
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx
index 9fd3d536dbce..cbc468d9f17b 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -23,9 +23,9 @@
 #include <cppuhelper/basemutex.hxx>
 #include <cppuhelper/compbase.hxx>
 #include <cppuhelper/interfacecontainer.h>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <comphelper/scopeguard.hxx>
-#include <comphelper/servicedecl.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <cppcanvas/polypolygon.hxx>
 
@@ -44,6 +44,7 @@
 #include <com/sun/star/presentation/XSlideShowListener.hpp>
 #include <com/sun/star/lang/NoSupportException.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
 #include <com/sun/star/drawing/PointSequence.hpp>
 #include <com/sun/star/drawing/XLayer.hpp>
@@ -177,7 +178,7 @@ private:
 
  ******************************************************************************/
 
-typedef cppu::WeakComponentImplHelper<presentation::XSlideShow> SlideShowImplBase;
+typedef cppu::WeakComponentImplHelper<css::lang::XServiceInfo, presentation::XSlideShow> SlideShowImplBase;
 
 typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector;
 
@@ -255,6 +256,11 @@ public:
     virtual std::shared_ptr<avmedia::MediaTempFile> getMediaTempFile(const OUString& aUrl) override;
 
 private:
+    // XServiceInfo
+    virtual OUString SAL_CALL getImplementationName() override;
+    virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override;
+
     // XSlideShow:
     virtual sal_Bool SAL_CALL nextEffect() override;
     virtual sal_Bool SAL_CALL previousEffect() override;
@@ -664,6 +670,21 @@ void SlideShowImpl::disposing()
     mpPreviousSlide.reset();
 }
 
+uno::Sequence< OUString > SAL_CALL SlideShowImpl::getSupportedServiceNames()
+{
+    return { "com.sun.star.presentation.SlideShow" };
+}
+
+OUString SAL_CALL SlideShowImpl::getImplementationName()
+{
+    return "com.sun.star.comp.presentation.SlideShow";
+}
+
+sal_Bool SAL_CALL SlideShowImpl::supportsService(const OUString& aServiceName)
+{
+    return cppu::supportsService(this, aServiceName);
+}
+
 /// stops the current slide transition sound
 void SlideShowImpl::stopSlideTransitionSound()
 {
@@ -2387,18 +2408,10 @@ void FrameSynchronization::Deactivate()
 
 } // anon namespace
 
-namespace sdecl = comphelper::service_decl;
-const sdecl::ServiceDecl slideShowDecl(
-     sdecl::class_<SlideShowImpl>(),
-    "com.sun.star.comp.presentation.SlideShow",
-    "com.sun.star.presentation.SlideShow" );
-
-// The C shared lib entry points
-extern "C"
-SAL_DLLPUBLIC_EXPORT void* slideshow_component_getFactory( char const* pImplName,
-                                         void*, void* )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+slideshow_SlideShowImpl_get_implementation(
+    css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
 {
-    return sdecl::component_getFactoryHelper( pImplName, {&slideShowDecl} );
+    return cppu::acquire(new SlideShowImpl(context));
 }
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/util/slideshow.component b/slideshow/util/slideshow.component
index 1cf2cb8933f4..25a4ac62d5ad 100644
--- a/slideshow/util/slideshow.component
+++ b/slideshow/util/slideshow.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="slideshow" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.presentation.SlideShow">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.presentation.SlideShow"
+    constructor="slideshow_SlideShowImpl_get_implementation">
     <service name="com.sun.star.presentation.SlideShow"/>
   </implementation>
 </component>


More information about the Libreoffice-commits mailing list