Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / cairo / cairo_services.cxx
blob936fc9889ea858d32eeab4d85a2ad32e68d024a0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <canvas/debug.hxx>
21 #include <canvas/verbosetrace.hxx>
22 #include <canvas/canvastools.hxx>
24 #include <com/sun/star/registry/XRegistryKey.hpp>
25 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
26 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <cppuhelper/factory.hxx>
29 #include <cppuhelper/implementationentry.hxx>
30 #include <comphelper/servicedecl.hxx>
32 #include <algorithm>
34 #include "cairo_canvas.hxx"
35 #include "cairo_spritecanvas.hxx"
38 using namespace ::com::sun::star;
40 #if defined(WNT) || defined (MACOSX)
41 # error "The cairo canvas should not be enabled on Windows or Mac cf fdo#46901"
42 #endif
44 namespace cairocanvas
46 static uno::Reference<uno::XInterface> initCanvas( Canvas* pCanvas )
48 uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas));
49 pCanvas->initialize();
50 return xRet;
53 namespace sdecl = comphelper::service_decl;
54 sdecl::class_< Canvas, sdecl::with_args<true> > serviceImpl1(&initCanvas);
55 const sdecl::ServiceDecl cairoCanvasDecl(
56 serviceImpl1,
57 CANVAS_IMPLEMENTATION_NAME,
58 CANVAS_SERVICE_NAME );
60 static uno::Reference<uno::XInterface> initSpriteCanvas( SpriteCanvas* pCanvas )
62 uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas));
63 pCanvas->initialize();
64 return xRet;
67 namespace sdecl = comphelper::service_decl;
68 sdecl::class_< SpriteCanvas, sdecl::with_args<true> > serviceImpl2(&initSpriteCanvas);
69 const sdecl::ServiceDecl cairoSpriteCanvasDecl(
70 serviceImpl2,
71 SPRITECANVAS_IMPLEMENTATION_NAME,
72 SPRITECANVAS_SERVICE_NAME );
75 // The C shared lib entry points
76 COMPHELPER_SERVICEDECL_EXPORTS2(cairocanvas, cairocanvas::cairoCanvasDecl, cairocanvas::cairoSpriteCanvasDecl)
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */