Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <drawinglayer/drawinglayerdllapi.h>
21 : #include <com/sun/star/uno/Reference.h>
22 : #include <com/sun/star/uno/RuntimeException.hpp>
23 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 : #include <com/sun/star/lang/XComponent.hpp>
25 : #include <com/sun/star/registry/XRegistryKey.hpp>
26 : #include <com/sun/star/lang/XComponent.hpp>
27 : #include <com/sun/star/lang/XServiceInfo.hpp>
28 : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
29 : #include <uno/environment.h>
30 : #include <cppuhelper/factory.hxx>
31 :
32 : //////////////////////////////////////////////////////////////////////////////
33 :
34 : using namespace ::com::sun::star;
35 :
36 : //////////////////////////////////////////////////////////////////////////////
37 : // predefines
38 :
39 : namespace drawinglayer
40 : {
41 : namespace unorenderer
42 : {
43 : extern uno::Sequence< rtl::OUString > SAL_CALL XPrimitive2DRenderer_getSupportedServiceNames();
44 : extern rtl::OUString SAL_CALL XPrimitive2DRenderer_getImplementationName();
45 : extern uno::Reference< uno::XInterface > SAL_CALL XPrimitive2DRenderer_createInstance( const uno::Reference< lang::XMultiServiceFactory > & );
46 : } // end of namespace unorenderer
47 : } // end of namespace drawinglayer
48 :
49 : //////////////////////////////////////////////////////////////////////////////
50 : // component_getImplementationEnvironment
51 :
52 : extern "C"
53 : {
54 0 : DRAWINGLAYER_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
55 : {
56 0 : *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
57 0 : }
58 : }
59 :
60 : //////////////////////////////////////////////////////////////////////////////
61 : // component_getFactory
62 :
63 : extern "C"
64 : {
65 0 : DRAWINGLAYER_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
66 : {
67 0 : uno::Reference< lang::XSingleServiceFactory > xFactory;
68 0 : void* pRet = 0;
69 :
70 0 : if(drawinglayer::unorenderer::XPrimitive2DRenderer_getImplementationName().equalsAscii(pImplName))
71 : {
72 : xFactory = ::cppu::createSingleFactory(
73 : reinterpret_cast< lang::XMultiServiceFactory * >(pServiceManager),
74 : drawinglayer::unorenderer::XPrimitive2DRenderer_getImplementationName(),
75 : drawinglayer::unorenderer::XPrimitive2DRenderer_createInstance,
76 0 : drawinglayer::unorenderer::XPrimitive2DRenderer_getSupportedServiceNames());
77 : }
78 :
79 0 : if(xFactory.is())
80 : {
81 0 : xFactory->acquire();
82 0 : pRet = xFactory.get();
83 : }
84 :
85 0 : return pRet;
86 : }
87 : }
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|