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 #include <cppuhelper/factory.hxx>
25
26 #include <com/sun/star/container/XSet.hpp>
27
28 #include <osl/diagnose.h>
29
30 #include "KDE4FilePicker.hxx"
31 #include "FPServiceInfo.hxx"
32
33 using namespace ::rtl;
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::container;
36 using namespace ::com::sun::star::lang;
37 using namespace ::com::sun::star::registry;
38 using namespace ::cppu;
39 using ::com::sun::star::ui::dialogs::XFilePicker;
40
createInstance(const Reference<XMultiServiceFactory> & serviceManager)41 static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& serviceManager )
42 {
43 return Reference< XInterface >(static_cast< XFilePicker* >( new KDE4FilePicker( serviceManager ) ) );
44 }
45
46 // the three uno functions that will be exported
47 extern "C"
48 {
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)49 SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
50 {
51 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
52 }
53
component_getFactory(const sal_Char * pImplName,uno_Interface * pSrvManager,uno_Interface *)54 SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* )
55 {
56 void* pRet = 0;
57
58 if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) )
59 {
60 Sequence< OUString > aSNS( 1 );
61 aSNS.getArray( )[0] = OUString::createFromAscii( FILE_PICKER_SERVICE_NAME );
62
63 Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
64 reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
65 OUString::createFromAscii( pImplName ),
66 createInstance,
67 aSNS ) );
68 if ( xFactory.is() )
69 {
70 xFactory->acquire();
71 pRet = xFactory.get();
72 }
73 }
74
75 return pRet;
76 }
77 }
78