From 6dbfba16d86b81419d833c6ab2c4904b67770069 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 16 Jul 2020 09:31:52 +0200 Subject: 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 --- .../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(-) (limited to 'slideshow') 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 #include #include +#include #include #include -#include +#include #include #include -#include - #include #include @@ -1154,15 +1153,29 @@ OGLTransitionerImpl::OGLTransitionerImpl() { } -typedef cppu::WeakComponentImplHelper OGLTransitionFactoryImplBase; +typedef cppu::WeakComponentImplHelper 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_(), - "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 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 @@ --> - + xmlns="http://openoffice.org/2010/uno-components"> + 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 #include #include +#include #include -#include #include #include @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -177,7 +178,7 @@ private: ******************************************************************************/ -typedef cppu::WeakComponentImplHelper SlideShowImplBase; +typedef cppu::WeakComponentImplHelper SlideShowImplBase; typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector; @@ -255,6 +256,11 @@ public: virtual std::shared_ptr 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_(), - "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 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 @@ --> - + xmlns="http://openoffice.org/2010/uno-components"> + -- cgit