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 /* genericfilter: mostly generic code for registering the filter
23 */
24
25 /* "This product is not manufactured, approved, or supported by
26 * Corel Corporation or Corel Corporation Limited."
27 * Portions of this code Copyright 2000 by Sun Microsystems, Inc.
28 * Rest is Copyright (C) 2002 William Lachance (wlach@interlog.com)
29 */
30 #include <stdio.h>
31
32 #include <osl/mutex.hxx>
33 #include <osl/thread.h>
34 #include <cppuhelper/factory.hxx>
35 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
36
37 #include "WordPerfectImportFilter.hxx"
38
39 using namespace ::rtl;
40 using namespace ::cppu;
41 using namespace ::com::sun::star::uno;
42 using namespace ::com::sun::star::lang;
43 using namespace ::com::sun::star::registry;
44
45 extern "C"
46 {
47 //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)48 void SAL_CALL component_getImplementationEnvironment(
49 const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
50 {
51 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
52 }
53 //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)54 void * SAL_CALL component_getFactory(
55 const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
56 {
57 void * pRet = 0;
58
59 OUString implName = OUString::createFromAscii( pImplName );
60 if ( pServiceManager && implName.equals(WordPerfectImportFilter_getImplementationName()) )
61 {
62 Reference< XSingleServiceFactory > xFactory( createSingleFactory(
63 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
64 OUString::createFromAscii( pImplName ),
65 WordPerfectImportFilter_createInstance, WordPerfectImportFilter_getSupportedServiceNames() ) );
66
67 if (xFactory.is())
68 {
69 xFactory->acquire();
70 pRet = xFactory.get();
71 }
72 }
73
74 return pRet;
75 }
76 }
77