xref: /trunk/main/filter/source/svg/svguno.cxx (revision cb0a2370)
19e0fc027SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39e0fc027SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49e0fc027SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59e0fc027SAndrew Rist  * distributed with this work for additional information
69e0fc027SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79e0fc027SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89e0fc027SAndrew Rist  * "License"); you may not use this file except in compliance
99e0fc027SAndrew Rist  * with the License.  You may obtain a copy of the License at
109e0fc027SAndrew Rist  *
119e0fc027SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
129e0fc027SAndrew Rist  *
139e0fc027SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149e0fc027SAndrew Rist  * software distributed under the License is distributed on an
159e0fc027SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169e0fc027SAndrew Rist  * KIND, either express or implied.  See the License for the
179e0fc027SAndrew Rist  * specific language governing permissions and limitations
189e0fc027SAndrew Rist  * under the License.
199e0fc027SAndrew Rist  *
209e0fc027SAndrew Rist  *************************************************************/
219e0fc027SAndrew Rist 
229e0fc027SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_filter.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <stdio.h>
28cdf0e10cSrcweir #include <osl/mutex.hxx>
29cdf0e10cSrcweir #include <osl/thread.h>
30cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
31cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <svgfilter.hxx>
34cdf0e10cSrcweir #include <svgdialog.hxx>
35*cb0a2370SArmin Le Grand #include <svgwriter.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir using ::rtl::OUString;
38cdf0e10cSrcweir using namespace ::cppu;
39cdf0e10cSrcweir using namespace ::com::sun::star::uno;
40cdf0e10cSrcweir using namespace ::com::sun::star::lang;
41cdf0e10cSrcweir using namespace ::com::sun::star::registry;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir extern "C"
44cdf0e10cSrcweir {
45cdf0e10cSrcweir     //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)46cdf0e10cSrcweir     SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
47cdf0e10cSrcweir 	    const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
48cdf0e10cSrcweir     {
49cdf0e10cSrcweir 	    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
50cdf0e10cSrcweir     }
51cdf0e10cSrcweir     //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)52cdf0e10cSrcweir     SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
53cdf0e10cSrcweir 	    const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
54cdf0e10cSrcweir     {
55cdf0e10cSrcweir 	    void * pRet = 0;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir         const OUString aImplName = OUString::createFromAscii( pImplName );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 		if( pServiceManager  )
60cdf0e10cSrcweir 	    {
61cdf0e10cSrcweir 			Reference< XSingleServiceFactory > xFactory;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 			if( aImplName.equals( SVGFilter_getImplementationName() ) )
64cdf0e10cSrcweir 			{
65cdf0e10cSrcweir 				xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
66cdf0e10cSrcweir 					reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
67cdf0e10cSrcweir 					OUString::createFromAscii( pImplName ),
68cdf0e10cSrcweir 					SVGFilter_createInstance, SVGFilter_getSupportedServiceNames() ) );
69cdf0e10cSrcweir 			}
70cdf0e10cSrcweir 			else if( aImplName.equals( SVGDialog_getImplementationName() ) )
71cdf0e10cSrcweir 			{
72cdf0e10cSrcweir 				xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
73cdf0e10cSrcweir 					reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
74cdf0e10cSrcweir 					OUString::createFromAscii( pImplName ),
75cdf0e10cSrcweir 					SVGDialog_createInstance, SVGDialog_getSupportedServiceNames() ) );
76cdf0e10cSrcweir 			}
77*cb0a2370SArmin Le Grand 			else if( aImplName.equals( SVGWriter_getImplementationName() ) )
78*cb0a2370SArmin Le Grand 			{
79*cb0a2370SArmin Le Grand 				xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
80*cb0a2370SArmin Le Grand 					reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
81*cb0a2370SArmin Le Grand 					OUString::createFromAscii( pImplName ),
82*cb0a2370SArmin Le Grand 					SVGWriter_createInstance, SVGWriter_getSupportedServiceNames() ) );
83*cb0a2370SArmin Le Grand 			}
84cdf0e10cSrcweir 		    if (xFactory.is())
85cdf0e10cSrcweir 		    {
86cdf0e10cSrcweir 			    xFactory->acquire();
87cdf0e10cSrcweir 			    pRet = xFactory.get();
88cdf0e10cSrcweir 		    }
89cdf0e10cSrcweir 	    }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	    return pRet;
92cdf0e10cSrcweir     }
93cdf0e10cSrcweir }
94