diff options
author | Noel Grandin <noel@peralex.com> | 2020-07-14 14:14:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-14 16:37:49 +0200 |
commit | cae6c5d896b8b99269ac2f21cc995f9d69219976 (patch) | |
tree | f9e938ae1f8802b076e071b836a395d5fc71d3ff /canvas/source/directx | |
parent | a03bc509cd19011043c340b893e7b00c7937423c (diff) |
canvas/directx9: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: Id8d6ef240ba872f7e93752614cd2d45fc50897ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98729
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas/source/directx')
-rw-r--r-- | canvas/source/directx/directx9canvas.component | 5 | ||||
-rw-r--r-- | canvas/source/directx/dx_canvas.cxx | 9 | ||||
-rw-r--r-- | canvas/source/directx/dx_spritecanvas.cxx | 49 | ||||
-rw-r--r-- | canvas/source/directx/dx_spritecanvas.hxx | 9 |
4 files changed, 41 insertions, 31 deletions
diff --git a/canvas/source/directx/directx9canvas.component b/canvas/source/directx/directx9canvas.component index a515799d24c9..ac75940d2cad 100644 --- a/canvas/source/directx/directx9canvas.component +++ b/canvas/source/directx/directx9canvas.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="directx9canvas" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.rendering.SpriteCanvas.DX9"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.rendering.SpriteCanvas.DX9" + constructor="canvas_directx9_SpriteCanvas_get_implementation"> <service name="com.sun.star.rendering.SpriteCanvas.DX9"/> </implementation> </component> diff --git a/canvas/source/directx/dx_canvas.cxx b/canvas/source/directx/dx_canvas.cxx index 39864b14e77d..1f4f1218beb9 100644 --- a/canvas/source/directx/dx_canvas.cxx +++ b/canvas/source/directx/dx_canvas.cxx @@ -48,11 +48,10 @@ #include "dx_graphicsprovider.hxx" #include "dx_winstuff.hxx" -#define CANVAS_TECH "GDI+" -#define CANVAS_SERVICE_NAME "com.sun.star.rendering.Canvas." CANVAS_TECH -#define CANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.Canvas." CANVAS_TECH -#define BITMAPCANVAS_SERVICE_NAME "com.sun.star.rendering.BitmapCanvas." CANVAS_TECH -#define BITMAPCANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.BitmapCanvas." CANVAS_TECH +#define CANVAS_SERVICE_NAME "com.sun.star.rendering.Canvas.GDI+" +#define CANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.Canvas.GDI+" +#define BITMAPCANVAS_SERVICE_NAME "com.sun.star.rendering.BitmapCanvas.GDI+" +#define BITMAPCANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.BitmapCanvas.GDI+" using namespace ::com::sun::star; diff --git a/canvas/source/directx/dx_spritecanvas.cxx b/canvas/source/directx/dx_spritecanvas.cxx index e4ef8a5764d6..eb589dfa9344 100644 --- a/canvas/source/directx/dx_spritecanvas.cxx +++ b/canvas/source/directx/dx_spritecanvas.cxx @@ -28,9 +28,7 @@ #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <comphelper/servicedecl.hxx> -#include <cppuhelper/factory.hxx> -#include <cppuhelper/implementationentry.hxx> +#include <cppuhelper/supportsservice.hxx> #include <osl/mutex.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <tools/diagnose_ex.h> @@ -41,16 +39,9 @@ #include "dx_spritecanvas.hxx" #include "dx_winstuff.hxx" -#define CANVAS_TECH "DX9" - -#define SPRITECANVAS_SERVICE_NAME "com.sun.star.rendering.SpriteCanvas." CANVAS_TECH -#define SPRITECANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.SpriteCanvas." CANVAS_TECH - using namespace ::com::sun::star; -namespace sdecl = comphelper::service_decl; - namespace dxcanvas { SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >& aArguments, @@ -151,7 +142,21 @@ namespace dxcanvas OUString SAL_CALL SpriteCanvas::getServiceName( ) { - return SPRITECANVAS_SERVICE_NAME; + return "com.sun.star.rendering.SpriteCanvas.DX9"; + } + + // XServiceInfo + css::uno::Sequence<OUString> SpriteCanvas::getSupportedServiceNames( ) + { + return { "com.sun.star.rendering.SpriteCanvas.DX9" }; + } + OUString SpriteCanvas::getImplementationName( ) + { + return "com.sun.star.comp.rendering.SpriteCanvas.DX9"; + } + sal_Bool SpriteCanvas::supportsService( const OUString& sServiceName ) + { + return cppu::supportsService(this, sServiceName); } const IDXRenderModuleSharedPtr& SpriteCanvas::getRenderModule() const @@ -180,19 +185,17 @@ namespace dxcanvas return xRet; } - sdecl::class_<SpriteCanvas, sdecl::with_args<true> > const serviceImpl(&initCanvas); - const sdecl::ServiceDecl dxSpriteCanvasDecl( - serviceImpl, - SPRITECANVAS_IMPLEMENTATION_NAME, - SPRITECANVAS_SERVICE_NAME ); -} + extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* + canvas_directx9_SpriteCanvas_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args) + { + rtl::Reference<SpriteCanvas> xCanvas(new SpriteCanvas(args, context)); + xCanvas->initialize(); + xCanvas->acquire(); + return static_cast<cppu::OWeakObject*>(xCanvas.get()); + } -// The C shared lib entry points -extern "C" -SAL_DLLPUBLIC_EXPORT void* directx9canvas_component_getFactory( char const* pImplName, - void*, void* ) -{ - return sdecl::component_getFactoryHelper( pImplName, {&dxcanvas::dxSpriteCanvasDecl} ); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/directx/dx_spritecanvas.hxx b/canvas/source/directx/dx_spritecanvas.hxx index 22832bccef89..26f62f4e68ba 100644 --- a/canvas/source/directx/dx_spritecanvas.hxx +++ b/canvas/source/directx/dx_spritecanvas.hxx @@ -25,6 +25,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/awt/XWindowListener.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/util/XUpdatable.hpp> @@ -58,7 +59,8 @@ namespace dxcanvas css::awt::XWindowListener, css::util::XUpdatable, css::beans::XPropertySet, - css::lang::XServiceName > WindowGraphicDeviceBase_Base; + css::lang::XServiceName, + css::lang::XServiceInfo> WindowGraphicDeviceBase_Base; typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >, SpriteDeviceHelper, ::osl::MutexGuard, @@ -129,6 +131,11 @@ namespace dxcanvas // XServiceName virtual OUString SAL_CALL getServiceName( ) override; + // XServiceInfo + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames( ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ) override; + /// Retrieve rendermodule object for this Canvas const IDXRenderModuleSharedPtr& getRenderModule() const; |