xref: /aoo41x/main/canvas/source/vcl/services.cxx (revision 25ea7f45)
1*25ea7f45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*25ea7f45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*25ea7f45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*25ea7f45SAndrew Rist  * distributed with this work for additional information
6*25ea7f45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*25ea7f45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*25ea7f45SAndrew Rist  * "License"); you may not use this file except in compliance
9*25ea7f45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*25ea7f45SAndrew Rist  *
11*25ea7f45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*25ea7f45SAndrew Rist  *
13*25ea7f45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*25ea7f45SAndrew Rist  * software distributed under the License is distributed on an
15*25ea7f45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*25ea7f45SAndrew Rist  * KIND, either express or implied.  See the License for the
17*25ea7f45SAndrew Rist  * specific language governing permissions and limitations
18*25ea7f45SAndrew Rist  * under the License.
19*25ea7f45SAndrew Rist  *
20*25ea7f45SAndrew Rist  *************************************************************/
21*25ea7f45SAndrew Rist 
22*25ea7f45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_canvas.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <canvas/debug.hxx>
28cdf0e10cSrcweir #include <canvas/verbosetrace.hxx>
29cdf0e10cSrcweir #include <canvas/canvastools.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
32cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
33cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
36cdf0e10cSrcweir #include <cppuhelper/implementationentry.hxx>
37cdf0e10cSrcweir #include <comphelper/servicedecl.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <vcl/canvastools.hxx>
40cdf0e10cSrcweir #include <vcl/outdev.hxx>
41cdf0e10cSrcweir #include <vcl/window.hxx>
42cdf0e10cSrcweir #include <vcl/bitmapex.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #include <basegfx/tools/canvastools.hxx>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #include <algorithm>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #include "canvas.hxx"
49cdf0e10cSrcweir #include "spritecanvas.hxx"
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
52cdf0e10cSrcweir using namespace ::com::sun::star;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir namespace vclcanvas
55cdf0e10cSrcweir {
56cdf0e10cSrcweir     namespace sdecl = comphelper::service_decl;
57cdf0e10cSrcweir 
initCanvas(Canvas * pCanvas)58cdf0e10cSrcweir     static uno::Reference<uno::XInterface> initCanvas( Canvas* pCanvas )
59cdf0e10cSrcweir     {
60cdf0e10cSrcweir         uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas));
61cdf0e10cSrcweir         pCanvas->initialize();
62cdf0e10cSrcweir         return xRet;
63cdf0e10cSrcweir     }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     sdecl::class_<Canvas, sdecl::with_args<true> > serviceImpl1(&initCanvas);
66cdf0e10cSrcweir     const sdecl::ServiceDecl vclCanvasDecl(
67cdf0e10cSrcweir         serviceImpl1,
68cdf0e10cSrcweir         CANVAS_IMPLEMENTATION_NAME,
69cdf0e10cSrcweir         CANVAS_SERVICE_NAME );
70cdf0e10cSrcweir 
initSpriteCanvas(SpriteCanvas * pCanvas)71cdf0e10cSrcweir     static uno::Reference<uno::XInterface> initSpriteCanvas( SpriteCanvas* pCanvas )
72cdf0e10cSrcweir     {
73cdf0e10cSrcweir         uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas));
74cdf0e10cSrcweir         pCanvas->initialize();
75cdf0e10cSrcweir         return xRet;
76cdf0e10cSrcweir     }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     sdecl::class_<SpriteCanvas, sdecl::with_args<true> > serviceImpl2(&initSpriteCanvas);
79cdf0e10cSrcweir     const sdecl::ServiceDecl vclSpriteCanvasDecl(
80cdf0e10cSrcweir         serviceImpl2,
81cdf0e10cSrcweir         SPRITECANVAS_IMPLEMENTATION_NAME,
82cdf0e10cSrcweir         SPRITECANVAS_SERVICE_NAME );
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir // The C shared lib entry points
86cdf0e10cSrcweir COMPHELPER_SERVICEDECL_EXPORTS2(vclcanvas::vclCanvasDecl, vclcanvas::vclSpriteCanvasDecl)
87