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