update dev300-m58
[ooovba.git] / fpicker / source / unx / kde4 / KDE4FPEntry.cxx
blob1fe357d23b07b4707c8ee1b5d81e331d93297d21
1 /*************************************************************************
9 * The Contents of this file are made available subject to the terms of
10 * either of the following licenses
12 * - GNU Lesser General Public License Version 2.1
13 * - Sun Industry Standards Source License Version 1.1
15 * Sun Microsystems Inc., October, 2000
17 * GNU Lesser General Public License Version 2.1
18 * =============================================
19 * Copyright 2000 by Sun Microsystems, Inc.
20 * 901 San Antonio Road, Palo Alto, CA 94303, USA
22 * This library is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU Lesser General Public
24 * License version 2.1, as published by the Free Software Foundation.
26 * This library is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Lesser General Public License for more details.
31 * You should have received a copy of the GNU Lesser General Public
32 * License along with this library; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 * MA 02111-1307 USA
37 * Sun Industry Standards Source License Version 1.1
38 * =================================================
39 * The contents of this file are subject to the Sun Industry Standards
40 * Source License Version 1.1 (the "License"); You may not use this file
41 * except in compliance with the License. You may obtain a copy of the
42 * License at http://www.openoffice.org/license.html.
44 * Software provided under this License is provided on an "AS IS" basis,
45 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
46 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
47 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
48 * See the License for the specific provisions governing your rights and
49 * obligations concerning the Software.
51 * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
53 * Copyright: 2000 by Sun Microsystems, Inc.
55 * All Rights Reserved.
57 * Contributor(s): _______________________________________
60 ************************************************************************/
62 #include <cppuhelper/factory.hxx>
64 #include <com/sun/star/container/XSet.hpp>
66 #include <osl/diagnose.h>
68 #include "KDE4FilePicker.hxx"
69 #include "FPServiceInfo.hxx"
71 using namespace ::rtl;
72 using namespace ::com::sun::star::uno;
73 using namespace ::com::sun::star::container;
74 using namespace ::com::sun::star::lang;
75 using namespace ::com::sun::star::registry;
76 using namespace ::cppu;
77 using ::com::sun::star::ui::dialogs::XFilePicker;
79 static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& serviceManager )
81 return Reference< XInterface >(static_cast< XFilePicker* >( new KDE4FilePicker( serviceManager ) ) );
84 // the three uno functions that will be exported
85 extern "C"
87 void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
89 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
92 sal_Bool SAL_CALL component_writeInfo( void*, void* pRegistryKey )
94 sal_Bool bRetVal = sal_True;
96 if ( pRegistryKey )
98 try
100 Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) );
101 pXNewKey->createKey( OUString::createFromAscii( FILE_PICKER_REGKEY_NAME ) );
103 catch( InvalidRegistryException& )
105 OSL_ENSURE( sal_False, "InvalidRegistryException caught" );
106 bRetVal = sal_False;
110 return bRetVal;
113 void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* )
115 void* pRet = 0;
117 if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) )
119 Sequence< OUString > aSNS( 1 );
120 aSNS.getArray( )[0] = OUString::createFromAscii( FILE_PICKER_SERVICE_NAME );
122 Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
123 reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
124 OUString::createFromAscii( pImplName ),
125 createInstance,
126 aSNS ) );
127 if ( xFactory.is() )
129 xFactory->acquire();
130 pRet = xFactory.get();
134 return pRet;