1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Fopentry.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_fpicker.hxx"
34 //-----------------------------------------------------------------------
35 // includes of other projects
36 //-----------------------------------------------------------------------
37 #include <cppuhelper/factory.hxx>
38 #include <com/sun/star/container/XSet.hpp>
39 #include <osl/diagnose.h>
41 #ifndef _FILEPICKER_HXX_
42 #include "folderpicker.hxx"
45 #ifndef _FPSERVICEINFO_HXX_
46 #include "FOPServiceInfo.hxx"
48 #include "WinFOPImpl.hxx"
50 //-----------------------------------------------------------------------
51 // namespace directives
52 //-----------------------------------------------------------------------
54 using namespace ::rtl
;
55 using namespace ::com::sun::star::uno
;
56 using namespace ::com::sun::star::container
;
57 using namespace ::com::sun::star::lang
;
58 using namespace ::com::sun::star::registry
;
59 using namespace ::cppu
;
60 using com::sun::star::ui::dialogs::XFolderPicker
;
66 //-----------------------------------------------------------------------
68 //-----------------------------------------------------------------------
70 Reference
< XInterface
> SAL_CALL
createInstance( const Reference
< XMultiServiceFactory
>& rServiceManager
)
72 return Reference
< XInterface
>( static_cast< XFolderPicker
* >( new CFolderPicker( rServiceManager
) ) );
76 //-----------------------------------------------------------------------
77 // the 3 important functions which will be exported
78 //-----------------------------------------------------------------------
83 //----------------------------------------------------------------------
84 // component_getImplementationEnvironment
85 //----------------------------------------------------------------------
87 void SAL_CALL
component_getImplementationEnvironment(
88 const sal_Char
** ppEnvTypeName
, uno_Environment
** )
90 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
93 //-----------------------------------------------------------------------
95 //-----------------------------------------------------------------------
97 sal_Bool SAL_CALL
component_writeInfo( void*, void* pRegistryKey
)
99 sal_Bool bRetVal
= sal_True
;
105 Reference
< XRegistryKey
> pXNewKey( static_cast< XRegistryKey
* >( pRegistryKey
) );
106 pXNewKey
->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_REGKEY_NAME
) ) );
108 catch( InvalidRegistryException
& )
110 OSL_ENSURE(sal_False
, "InvalidRegistryException caught");
118 //----------------------------------------------------------------------
119 // component_getFactory
120 // returns a factory to create XFilePicker-Services
121 //----------------------------------------------------------------------
123 void* SAL_CALL
component_getFactory( const sal_Char
* pImplName
, uno_Interface
* pSrvManager
, uno_Interface
* )
127 if ( pSrvManager
&& ( 0 == rtl_str_compare( pImplName
, FOLDER_PICKER_IMPL_NAME
) ) )
129 Sequence
< OUString
> aSNS( 1 );
130 aSNS
.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME
) );
132 Reference
< XSingleServiceFactory
> xFactory ( createSingleFactory(
133 reinterpret_cast< XMultiServiceFactory
* > ( pSrvManager
),
134 OUString::createFromAscii( pImplName
),
140 pRet
= xFactory
.get();