xref: /AOO41X/main/filter/source/svg/svguno.cxx (revision cb0a237090961d5d535febddc90a7f3cc9d78045)
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 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_filter.hxx"
26 
27 #include <stdio.h>
28 #include <osl/mutex.hxx>
29 #include <osl/thread.h>
30 #include <cppuhelper/factory.hxx>
31 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
32 
33 #include <svgfilter.hxx>
34 #include <svgdialog.hxx>
35 #include <svgwriter.hxx>
36 
37 using ::rtl::OUString;
38 using namespace ::cppu;
39 using namespace ::com::sun::star::uno;
40 using namespace ::com::sun::star::lang;
41 using namespace ::com::sun::star::registry;
42 
43 extern "C"
44 {
45     //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)46     SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
47         const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
48     {
49         *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
50     }
51     //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)52     SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
53         const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
54     {
55         void * pRet = 0;
56 
57         const OUString aImplName = OUString::createFromAscii( pImplName );
58 
59         if( pServiceManager  )
60         {
61             Reference< XSingleServiceFactory > xFactory;
62 
63             if( aImplName.equals( SVGFilter_getImplementationName() ) )
64             {
65                 xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
66                     reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
67                     OUString::createFromAscii( pImplName ),
68                     SVGFilter_createInstance, SVGFilter_getSupportedServiceNames() ) );
69             }
70             else if( aImplName.equals( SVGDialog_getImplementationName() ) )
71             {
72                 xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
73                     reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
74                     OUString::createFromAscii( pImplName ),
75                     SVGDialog_createInstance, SVGDialog_getSupportedServiceNames() ) );
76             }
77             else if( aImplName.equals( SVGWriter_getImplementationName() ) )
78             {
79                 xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
80                     reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
81                     OUString::createFromAscii( pImplName ),
82                     SVGWriter_createInstance, SVGWriter_getSupportedServiceNames() ) );
83             }
84             if (xFactory.is())
85             {
86                 xFactory->acquire();
87                 pRet = xFactory.get();
88             }
89         }
90 
91         return pRet;
92     }
93 }
94