1b557fc96SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3b557fc96SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4b557fc96SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5b557fc96SAndrew Rist  * distributed with this work for additional information
6b557fc96SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7b557fc96SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8b557fc96SAndrew Rist  * "License"); you may not use this file except in compliance
9b557fc96SAndrew Rist  * with the License.  You may obtain a copy of the License at
10b557fc96SAndrew Rist  *
11b557fc96SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12b557fc96SAndrew Rist  *
13b557fc96SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14b557fc96SAndrew Rist  * software distributed under the License is distributed on an
15b557fc96SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b557fc96SAndrew Rist  * KIND, either express or implied.  See the License for the
17b557fc96SAndrew Rist  * specific language governing permissions and limitations
18b557fc96SAndrew Rist  * under the License.
19b557fc96SAndrew Rist  *
20b557fc96SAndrew Rist  *************************************************************/
21b557fc96SAndrew Rist 
22b557fc96SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <com/sun/star/container/XSet.hpp>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <osl/diagnose.h>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include "KDE4FilePicker.hxx"
31cdf0e10cSrcweir #include "FPServiceInfo.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir using namespace ::rtl;
34cdf0e10cSrcweir using namespace ::com::sun::star::uno;
35cdf0e10cSrcweir using namespace ::com::sun::star::container;
36cdf0e10cSrcweir using namespace ::com::sun::star::lang;
37cdf0e10cSrcweir using namespace ::com::sun::star::registry;
38cdf0e10cSrcweir using namespace ::cppu;
39cdf0e10cSrcweir using ::com::sun::star::ui::dialogs::XFilePicker;
40cdf0e10cSrcweir 
createInstance(const Reference<XMultiServiceFactory> & serviceManager)41cdf0e10cSrcweir static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& serviceManager )
42cdf0e10cSrcweir {
43cdf0e10cSrcweir     return Reference< XInterface >(static_cast< XFilePicker* >( new KDE4FilePicker( serviceManager ) ) );
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
46cdf0e10cSrcweir // the three uno functions that will be exported
47cdf0e10cSrcweir extern "C"
48cdf0e10cSrcweir {
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)49*8d854f23Sdamjan 	SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
50cdf0e10cSrcweir 	{
51cdf0e10cSrcweir 		*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
52cdf0e10cSrcweir 	}
53cdf0e10cSrcweir 
component_getFactory(const sal_Char * pImplName,uno_Interface * pSrvManager,uno_Interface *)54*8d854f23Sdamjan 	SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* )
55cdf0e10cSrcweir 	{
56cdf0e10cSrcweir 		void* pRet = 0;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 		if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) )
59cdf0e10cSrcweir 		{
60cdf0e10cSrcweir 			Sequence< OUString > aSNS( 1 );
61cdf0e10cSrcweir 			aSNS.getArray( )[0] = OUString::createFromAscii( FILE_PICKER_SERVICE_NAME );
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 			Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
64cdf0e10cSrcweir 						reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
65cdf0e10cSrcweir 						OUString::createFromAscii( pImplName ),
66cdf0e10cSrcweir 						createInstance,
67cdf0e10cSrcweir 						aSNS ) );
68cdf0e10cSrcweir 			if ( xFactory.is() )
69cdf0e10cSrcweir 			{
70cdf0e10cSrcweir 				xFactory->acquire();
71cdf0e10cSrcweir 				pRet = xFactory.get();
72cdf0e10cSrcweir 			}
73cdf0e10cSrcweir 		}
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 		return pRet;
76cdf0e10cSrcweir 	}
77cdf0e10cSrcweir }
78