xref: /aoo41x/main/shell/source/win32/SysShentry.cxx (revision f8e2c85a)
1*f8e2c85aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f8e2c85aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f8e2c85aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f8e2c85aSAndrew Rist  * distributed with this work for additional information
6*f8e2c85aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f8e2c85aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f8e2c85aSAndrew Rist  * "License"); you may not use this file except in compliance
9*f8e2c85aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f8e2c85aSAndrew Rist  *
11*f8e2c85aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f8e2c85aSAndrew Rist  *
13*f8e2c85aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f8e2c85aSAndrew Rist  * software distributed under the License is distributed on an
15*f8e2c85aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f8e2c85aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*f8e2c85aSAndrew Rist  * specific language governing permissions and limitations
18*f8e2c85aSAndrew Rist  * under the License.
19*f8e2c85aSAndrew Rist  *
20*f8e2c85aSAndrew Rist  *************************************************************/
21*f8e2c85aSAndrew Rist 
22*f8e2c85aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_shell.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 #include "SysShExec.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //-----------------------------------------------------------------------
36cdf0e10cSrcweir // namespace directives
37cdf0e10cSrcweir //-----------------------------------------------------------------------
38cdf0e10cSrcweir 
39cdf0e10cSrcweir using namespace ::rtl						;
40cdf0e10cSrcweir using namespace ::com::sun::star::uno		;
41cdf0e10cSrcweir using namespace ::com::sun::star::container	;
42cdf0e10cSrcweir using namespace ::com::sun::star::lang		;
43cdf0e10cSrcweir using namespace ::com::sun::star::registry	;
44cdf0e10cSrcweir using namespace ::cppu					    ;
45cdf0e10cSrcweir using com::sun::star::system::XSystemShellExecute;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //-----------------------------------------------------------------------
48cdf0e10cSrcweir // defines
49cdf0e10cSrcweir //-----------------------------------------------------------------------
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #define SYSSHEXEC_SERVICE_NAME  "com.sun.star.system.SystemShellExecute"
52cdf0e10cSrcweir #define SYSSHEXEC_IMPL_NAME     "com.sun.star.system.SystemShellExecute"
53cdf0e10cSrcweir #define SYSSHEXEC_REGKEY_NAME   "/com.sun.star.system.SystemShellExecute/UNO/SERVICES/com.sun.star.system.SystemShellExecute"
54cdf0e10cSrcweir 
55cdf0e10cSrcweir //-----------------------------------------------------------------------
56cdf0e10cSrcweir //
57cdf0e10cSrcweir //-----------------------------------------------------------------------
58cdf0e10cSrcweir 
59cdf0e10cSrcweir namespace
60cdf0e10cSrcweir {
createInstance(const Reference<XMultiServiceFactory> &)61cdf0e10cSrcweir 	Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& )
62cdf0e10cSrcweir 	{
63cdf0e10cSrcweir 		return Reference< XInterface >( static_cast< XSystemShellExecute* >( new CSysShExec( ) ) );
64cdf0e10cSrcweir 	}
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir //-----------------------------------------------------------------------
68cdf0e10cSrcweir // the 3 important functions which will be exported
69cdf0e10cSrcweir //-----------------------------------------------------------------------
70cdf0e10cSrcweir 
71cdf0e10cSrcweir extern "C"
72cdf0e10cSrcweir {
73cdf0e10cSrcweir 
74cdf0e10cSrcweir //----------------------------------------------------------------------
75cdf0e10cSrcweir // component_getImplementationEnvironment
76cdf0e10cSrcweir //----------------------------------------------------------------------
77cdf0e10cSrcweir 
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)78cdf0e10cSrcweir void SAL_CALL component_getImplementationEnvironment(
79cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ":affine";
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir //----------------------------------------------------------------------
85cdf0e10cSrcweir // component_getFactory
86cdf0e10cSrcweir // returns a factory to create XFilePicker-Services
87cdf0e10cSrcweir //----------------------------------------------------------------------
88cdf0e10cSrcweir 
component_getFactory(const sal_Char * pImplName,uno_Interface * pSrvManager,uno_Interface *)89cdf0e10cSrcweir void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ )
90cdf0e10cSrcweir {
91cdf0e10cSrcweir 	void* pRet = 0;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, SYSSHEXEC_IMPL_NAME ) ) )
94cdf0e10cSrcweir 	{
95cdf0e10cSrcweir 		Sequence< OUString > aSNS( 1 );
96cdf0e10cSrcweir         aSNS.getArray( )[0] = OUString::createFromAscii( SYSSHEXEC_SERVICE_NAME );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory(
99cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
100cdf0e10cSrcweir 			OUString::createFromAscii( pImplName ),
101cdf0e10cSrcweir 			createInstance,
102cdf0e10cSrcweir 			aSNS ) );
103cdf0e10cSrcweir 		if ( xFactory.is() )
104cdf0e10cSrcweir 		{
105cdf0e10cSrcweir 			xFactory->acquire();
106cdf0e10cSrcweir 			pRet = xFactory.get();
107cdf0e10cSrcweir 		}
108cdf0e10cSrcweir 	}
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	return pRet;
111cdf0e10cSrcweir }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir } // extern "C"
114