1ddde725dSArmin Le Grand /**************************************************************
2ddde725dSArmin Le Grand  *
3ddde725dSArmin Le Grand  * Licensed to the Apache Software Foundation (ASF) under one
4ddde725dSArmin Le Grand  * or more contributor license agreements.  See the NOTICE file
5ddde725dSArmin Le Grand  * distributed with this work for additional information
6ddde725dSArmin Le Grand  * regarding copyright ownership.  The ASF licenses this file
7ddde725dSArmin Le Grand  * to you under the Apache License, Version 2.0 (the
8ddde725dSArmin Le Grand  * "License"); you may not use this file except in compliance
9ddde725dSArmin Le Grand  * with the License.  You may obtain a copy of the License at
10ddde725dSArmin Le Grand  *
11*2b45cf47SArmin Le Grand  *   http://www.apache.org/licenses/LICENSE-2.0
12ddde725dSArmin Le Grand  *
13ddde725dSArmin Le Grand  * Unless required by applicable law or agreed to in writing,
14ddde725dSArmin Le Grand  * software distributed under the License is distributed on an
15ddde725dSArmin Le Grand  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ddde725dSArmin Le Grand  * KIND, either express or implied.  See the License for the
17ddde725dSArmin Le Grand  * specific language governing permissions and limitations
18ddde725dSArmin Le Grand  * under the License.
19ddde725dSArmin Le Grand  *
20ddde725dSArmin Le Grand  *************************************************************/
21ddde725dSArmin Le Grand 
22ddde725dSArmin Le Grand // MARKER(update_precomp.py): autogen include statement, do not remove
23ddde725dSArmin Le Grand #include "precompiled_drawinglayer.hxx"
24ddde725dSArmin Le Grand 
25ddde725dSArmin Le Grand #include <drawinglayer/drawinglayerdllapi.h>
26ddde725dSArmin Le Grand #include <com/sun/star/uno/Reference.h>
27ddde725dSArmin Le Grand #include <com/sun/star/uno/RuntimeException.hpp>
28ddde725dSArmin Le Grand #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29ddde725dSArmin Le Grand #include <com/sun/star/lang/XComponent.hpp>
30ddde725dSArmin Le Grand #include <com/sun/star/registry/XRegistryKey.hpp>
31ddde725dSArmin Le Grand #include <com/sun/star/lang/XComponent.hpp>
32ddde725dSArmin Le Grand #include <com/sun/star/lang/XServiceInfo.hpp>
33ddde725dSArmin Le Grand #include <com/sun/star/lang/XSingleServiceFactory.hpp>
34ddde725dSArmin Le Grand #include <uno/environment.h>
35ddde725dSArmin Le Grand #include <cppuhelper/factory.hxx>
36ddde725dSArmin Le Grand 
37ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
38ddde725dSArmin Le Grand 
39ddde725dSArmin Le Grand using namespace ::com::sun::star;
40ddde725dSArmin Le Grand 
41ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
42ddde725dSArmin Le Grand // predefines
43ddde725dSArmin Le Grand 
44ddde725dSArmin Le Grand namespace drawinglayer
45ddde725dSArmin Le Grand {
46ddde725dSArmin Le Grand 	namespace unorenderer
47ddde725dSArmin Le Grand 	{
48ddde725dSArmin Le Grand 	    extern uno::Sequence< rtl::OUString > SAL_CALL XPrimitive2DRenderer_getSupportedServiceNames();
49ddde725dSArmin Le Grand 	    extern rtl::OUString SAL_CALL XPrimitive2DRenderer_getImplementationName();
50ddde725dSArmin Le Grand 	    extern uno::Reference< uno::XInterface > SAL_CALL XPrimitive2DRenderer_createInstance( const uno::Reference< lang::XMultiServiceFactory > & );
51ddde725dSArmin Le Grand 	} // end of namespace unorenderer
52ddde725dSArmin Le Grand } // end of namespace drawinglayer
53ddde725dSArmin Le Grand 
54ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
55ddde725dSArmin Le Grand // component_getImplementationEnvironment
56ddde725dSArmin Le Grand 
57ddde725dSArmin Le Grand extern "C"
58ddde725dSArmin Le Grand {
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)59ddde725dSArmin Le Grand     DRAWINGLAYER_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
60ddde725dSArmin Le Grand     {
61ddde725dSArmin Le Grand 	    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
62ddde725dSArmin Le Grand     }
63ddde725dSArmin Le Grand }
64ddde725dSArmin Le Grand 
65ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
66ddde725dSArmin Le Grand // component_getFactory
67ddde725dSArmin Le Grand 
68ddde725dSArmin Le Grand extern "C"
69ddde725dSArmin Le Grand {
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)70ddde725dSArmin Le Grand     DRAWINGLAYER_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
71ddde725dSArmin Le Grand     {
72ddde725dSArmin Le Grand 	    uno::Reference< lang::XSingleServiceFactory > xFactory;
73ddde725dSArmin Le Grand 	    void* pRet = 0;
74ddde725dSArmin Le Grand 
75ddde725dSArmin Le Grand 	    if(drawinglayer::unorenderer::XPrimitive2DRenderer_getImplementationName().equalsAscii(pImplName))
76ddde725dSArmin Le Grand 	    {
77ddde725dSArmin Le Grand 		    xFactory = ::cppu::createSingleFactory(
78ddde725dSArmin Le Grand 			    reinterpret_cast< lang::XMultiServiceFactory * >(pServiceManager),
79ddde725dSArmin Le Grand 			    drawinglayer::unorenderer::XPrimitive2DRenderer_getImplementationName(),
80ddde725dSArmin Le Grand 			    drawinglayer::unorenderer::XPrimitive2DRenderer_createInstance,
81ddde725dSArmin Le Grand 			    drawinglayer::unorenderer::XPrimitive2DRenderer_getSupportedServiceNames());
82ddde725dSArmin Le Grand 	    }
83ddde725dSArmin Le Grand 
84ddde725dSArmin Le Grand 	    if(xFactory.is())
85ddde725dSArmin Le Grand 	    {
86ddde725dSArmin Le Grand 		    xFactory->acquire();
87ddde725dSArmin Le Grand 		    pRet = xFactory.get();
88ddde725dSArmin Le Grand 	    }
89ddde725dSArmin Le Grand 
90ddde725dSArmin Le Grand 	    return pRet;
91ddde725dSArmin Le Grand     }
92ddde725dSArmin Le Grand }
93ddde725dSArmin Le Grand 
94ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
95ddde725dSArmin Le Grand // eof
96