xref: /trunk/main/fpicker/source/win32/folderpicker/Fopentry.cxx (revision b557fc96600fce3029f73c89748b6c08fd00b34d)
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
10cdf0e10cSrcweir  *
11*b557fc96SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
20*b557fc96SAndrew Rist  *************************************************************/
21*b557fc96SAndrew Rist 
22*b557fc96SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_fpicker.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //-----------------------------------------------------------------------
28cdf0e10cSrcweir //  includes of other projects
29cdf0e10cSrcweir //-----------------------------------------------------------------------
30cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
31cdf0e10cSrcweir #include <com/sun/star/container/XSet.hpp>
32cdf0e10cSrcweir #include <osl/diagnose.h>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #ifndef _FILEPICKER_HXX_
35cdf0e10cSrcweir #include "folderpicker.hxx"
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #ifndef _FPSERVICEINFO_HXX_
39cdf0e10cSrcweir #include "FOPServiceInfo.hxx"
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #include "WinFOPImpl.hxx"
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //-----------------------------------------------------------------------
44cdf0e10cSrcweir // namespace directives
45cdf0e10cSrcweir //-----------------------------------------------------------------------
46cdf0e10cSrcweir 
47cdf0e10cSrcweir using namespace ::rtl                       ;
48cdf0e10cSrcweir using namespace ::com::sun::star::uno       ;
49cdf0e10cSrcweir using namespace ::com::sun::star::container ;
50cdf0e10cSrcweir using namespace ::com::sun::star::lang      ;
51cdf0e10cSrcweir using namespace ::com::sun::star::registry  ;
52cdf0e10cSrcweir using namespace ::cppu                      ;
53cdf0e10cSrcweir using com::sun::star::ui::dialogs::XFolderPicker;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir namespace
57cdf0e10cSrcweir {
58cdf0e10cSrcweir 
59cdf0e10cSrcweir     //-----------------------------------------------------------------------
60cdf0e10cSrcweir     //
61cdf0e10cSrcweir     //-----------------------------------------------------------------------
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
64cdf0e10cSrcweir     {
65cdf0e10cSrcweir         return Reference< XInterface >( static_cast< XFolderPicker* >( new CFolderPicker( rServiceManager ) ) );
66cdf0e10cSrcweir     }
67cdf0e10cSrcweir }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir //-----------------------------------------------------------------------
70cdf0e10cSrcweir // the 3 important functions which will be exported
71cdf0e10cSrcweir //-----------------------------------------------------------------------
72cdf0e10cSrcweir 
73cdf0e10cSrcweir extern "C"
74cdf0e10cSrcweir {
75cdf0e10cSrcweir 
76cdf0e10cSrcweir //----------------------------------------------------------------------
77cdf0e10cSrcweir // component_getImplementationEnvironment
78cdf0e10cSrcweir //----------------------------------------------------------------------
79cdf0e10cSrcweir 
80cdf0e10cSrcweir void SAL_CALL component_getImplementationEnvironment(
81cdf0e10cSrcweir     const sal_Char ** ppEnvTypeName, uno_Environment ** )
82cdf0e10cSrcweir {
83cdf0e10cSrcweir     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
84cdf0e10cSrcweir }
85cdf0e10cSrcweir 
86cdf0e10cSrcweir //----------------------------------------------------------------------
87cdf0e10cSrcweir // component_getFactory
88cdf0e10cSrcweir // returns a factory to create XFilePicker-Services
89cdf0e10cSrcweir //----------------------------------------------------------------------
90cdf0e10cSrcweir 
91cdf0e10cSrcweir void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* )
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     void* pRet = 0;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FOLDER_PICKER_IMPL_NAME ) ) )
96cdf0e10cSrcweir     {
97cdf0e10cSrcweir         Sequence< OUString > aSNS( 1 );
98cdf0e10cSrcweir         aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir         Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
101cdf0e10cSrcweir             reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
102cdf0e10cSrcweir             OUString::createFromAscii( pImplName ),
103cdf0e10cSrcweir             createInstance,
104cdf0e10cSrcweir             aSNS ) );
105cdf0e10cSrcweir         if ( xFactory.is() )
106cdf0e10cSrcweir         {
107cdf0e10cSrcweir             xFactory->acquire();
108cdf0e10cSrcweir             pRet = xFactory.get();
109cdf0e10cSrcweir         }
110cdf0e10cSrcweir     }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     return pRet;
113cdf0e10cSrcweir }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir } // extern "C"
116