xref: /aoo41x/main/fpicker/source/aqua/FPentry.cxx (revision b557fc96)
1*b557fc96SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b557fc96SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b557fc96SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b557fc96SAndrew Rist  * distributed with this work for additional information
6*b557fc96SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b557fc96SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b557fc96SAndrew Rist  * "License"); you may not use this file except in compliance
9*b557fc96SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b557fc96SAndrew Rist  *
11*b557fc96SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b557fc96SAndrew Rist  *
13*b557fc96SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b557fc96SAndrew Rist  * software distributed under the License is distributed on an
15*b557fc96SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b557fc96SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b557fc96SAndrew Rist  * specific language governing permissions and limitations
18*b557fc96SAndrew Rist  * under the License.
19*b557fc96SAndrew Rist  *
20*b557fc96SAndrew Rist  *************************************************************/
21*b557fc96SAndrew Rist 
22*b557fc96SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir //----------------------------------------------
25cdf0e10cSrcweir //  includes of other projects
26cdf0e10cSrcweir //----------------------------------------------
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
29cdf0e10cSrcweir #include <com/sun/star/container/XSet.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir // #ifndef _OSL_DIAGNOSE_H_
32cdf0e10cSrcweir // #include <osl/diagnose.h>
33cdf0e10cSrcweir // #endif
34cdf0e10cSrcweir #include "SalAquaFilePicker.hxx"
35cdf0e10cSrcweir #include "SalAquaFolderPicker.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir // #ifndef _SV_SVAPP_HXX
38cdf0e10cSrcweir // #include <vcl/svapp.hxx>
39cdf0e10cSrcweir // #endif
40cdf0e10cSrcweir #include "FPServiceInfo.hxx"
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //-----------------------------------------------
43cdf0e10cSrcweir // namespace directives
44cdf0e10cSrcweir //-----------------------------------------------
45cdf0e10cSrcweir 
46cdf0e10cSrcweir using namespace ::rtl;
47cdf0e10cSrcweir using namespace ::com::sun::star::uno;
48cdf0e10cSrcweir using namespace ::com::sun::star::container;
49cdf0e10cSrcweir using namespace ::com::sun::star::lang;
50cdf0e10cSrcweir using namespace ::com::sun::star::registry;
51cdf0e10cSrcweir using namespace ::cppu;
52cdf0e10cSrcweir using ::com::sun::star::ui::dialogs::XFilePicker;
53cdf0e10cSrcweir using ::com::sun::star::ui::dialogs::XFolderPicker;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir //------------------------------------------------
56cdf0e10cSrcweir //
57cdf0e10cSrcweir //------------------------------------------------
58cdf0e10cSrcweir 
createFileInstance(const Reference<XMultiServiceFactory> & rServiceManager)59cdf0e10cSrcweir static Reference< XInterface > SAL_CALL createFileInstance(
60cdf0e10cSrcweir     const Reference< XMultiServiceFactory >& rServiceManager )
61cdf0e10cSrcweir {
62cdf0e10cSrcweir     return Reference< XInterface >(
63cdf0e10cSrcweir         *new SalAquaFilePicker( rServiceManager ) );
64cdf0e10cSrcweir }
65cdf0e10cSrcweir 
createFolderInstance(const Reference<XMultiServiceFactory> & rServiceManager)66cdf0e10cSrcweir static Reference< XInterface > SAL_CALL createFolderInstance(
67cdf0e10cSrcweir     const Reference< XMultiServiceFactory >& rServiceManager )
68cdf0e10cSrcweir {
69cdf0e10cSrcweir     return Reference< XInterface >(
70cdf0e10cSrcweir         *new SalAquaFolderPicker( rServiceManager ) );
71cdf0e10cSrcweir }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir //------------------------------------------------
74cdf0e10cSrcweir // the three uno functions that will be exported
75cdf0e10cSrcweir //------------------------------------------------
76cdf0e10cSrcweir 
77cdf0e10cSrcweir extern "C"
78cdf0e10cSrcweir {
79cdf0e10cSrcweir 
80cdf0e10cSrcweir //------------------------------------------------
81cdf0e10cSrcweir // component_getImplementationEnvironment
82cdf0e10cSrcweir //------------------------------------------------
83cdf0e10cSrcweir 
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)84cdf0e10cSrcweir void SAL_CALL component_getImplementationEnvironment(
85cdf0e10cSrcweir     const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
86cdf0e10cSrcweir {
87cdf0e10cSrcweir     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
88cdf0e10cSrcweir }
89cdf0e10cSrcweir 
90cdf0e10cSrcweir //------------------------------------------------
91cdf0e10cSrcweir //
92cdf0e10cSrcweir //------------------------------------------------
93cdf0e10cSrcweir 
component_getFactory(const sal_Char * pImplName,uno_Interface * pSrvManager,uno_Interface *)94cdf0e10cSrcweir void* SAL_CALL component_getFactory(
95cdf0e10cSrcweir     const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ )
96cdf0e10cSrcweir {
97cdf0e10cSrcweir     void* pRet = 0;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     if( pSrvManager )
100cdf0e10cSrcweir     {
101cdf0e10cSrcweir             // FIXME: PJ: when we do not need native file and folder picker...
102cdf0e10cSrcweir             if (0) return 0;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir             Reference< XSingleServiceFactory > xFactory;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir             if (0 == rtl_str_compare(pImplName, FILE_PICKER_IMPL_NAME))
107cdf0e10cSrcweir             {
108cdf0e10cSrcweir                 Sequence< OUString > aSNS( 1 );
109cdf0e10cSrcweir                 aSNS.getArray( )[0] =
110cdf0e10cSrcweir                     OUString::createFromAscii(FILE_PICKER_SERVICE_NAME);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir                 xFactory = createSingleFactory(
113cdf0e10cSrcweir                     reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
114cdf0e10cSrcweir                     OUString::createFromAscii( pImplName ),
115cdf0e10cSrcweir                     createFileInstance,
116cdf0e10cSrcweir                     aSNS );
117cdf0e10cSrcweir             }
118cdf0e10cSrcweir             else if (0 == rtl_str_compare(pImplName, FOLDER_PICKER_IMPL_NAME))
119cdf0e10cSrcweir             {
120cdf0e10cSrcweir                 Sequence< OUString > aSNS( 1 );
121cdf0e10cSrcweir                 aSNS.getArray( )[0] =
122cdf0e10cSrcweir                     OUString::createFromAscii(FOLDER_PICKER_SERVICE_NAME);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir                 xFactory = createSingleFactory(
125cdf0e10cSrcweir                     reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
126cdf0e10cSrcweir                     OUString::createFromAscii( pImplName ),
127cdf0e10cSrcweir                     createFolderInstance,
128cdf0e10cSrcweir                     aSNS );
129cdf0e10cSrcweir             }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir             if ( xFactory.is() )
132cdf0e10cSrcweir             {
133cdf0e10cSrcweir                 xFactory->acquire();
134cdf0e10cSrcweir                 pRet = xFactory.get();
135cdf0e10cSrcweir             }
136cdf0e10cSrcweir     }
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     return pRet;
139cdf0e10cSrcweir }
140cdf0e10cSrcweir 
141cdf0e10cSrcweir } // extern "C"
142