1 /* genericfilter: mostly generic code for registering the filter
3 * Portions of this code Copyright 2000 by Sun Microsystems, Inc.
4 * Rest is Copyright (C) 2002 William Lachance (wlach@interlog.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 /* "This product is not manufactured, approved, or supported by
23 * Corel Corporation or Corel Corporation Limited."
27 #include <osl/mutex.hxx>
28 #include <osl/thread.h>
29 #include <cppuhelper/factory.hxx>
30 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
32 #include "WordPerfectImportFilter.hxx"
34 using namespace ::rtl
;
35 using namespace ::cppu
;
36 using namespace ::com::sun::star::uno
;
37 using namespace ::com::sun::star::lang
;
38 using namespace ::com::sun::star::registry
;
42 //==================================================================================================
43 void SAL_CALL
component_getImplementationEnvironment(
44 const sal_Char
** ppEnvTypeName
, uno_Environment
** /* ppEnv */ )
46 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
48 //==================================================================================================
49 sal_Bool SAL_CALL
component_writeInfo(
50 void * /* pServiceManager */, void * pRegistryKey
)
57 Reference
< XRegistryKey
> xNewKey(
58 reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey( WordPerfectImportFilter_getImplementationName() ) );
59 xNewKey
= xNewKey
->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
61 const Sequence
< OUString
> & rSNL
= WordPerfectImportFilter_getSupportedServiceNames();
62 const OUString
* pArray
= rSNL
.getConstArray();
63 for ( nPos
= rSNL
.getLength(); nPos
--; )
64 xNewKey
->createKey( pArray
[nPos
] );
68 catch (InvalidRegistryException
&)
70 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
75 //==================================================================================================
76 void * SAL_CALL
component_getFactory(
77 const sal_Char
* pImplName
, void * pServiceManager
, void * /* pRegistryKey */ )
81 OUString implName
= OUString::createFromAscii( pImplName
);
82 if ( pServiceManager
&& implName
.equals(WordPerfectImportFilter_getImplementationName()) )
84 Reference
< XSingleServiceFactory
> xFactory( createSingleFactory(
85 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
),
86 OUString::createFromAscii( pImplName
),
87 WordPerfectImportFilter_createInstance
, WordPerfectImportFilter_getSupportedServiceNames() ) );
92 pRet
= xFactory
.get();