1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_shell.hxx"
26 
27 //-----------------------------------------------------------------------
28 //	includes of other projects
29 //-----------------------------------------------------------------------
30 #include <cppuhelper/factory.hxx>
31 #include <com/sun/star/container/XSet.hpp>
32 #include <osl/diagnose.h>
33 #include "cmdmailsuppl.hxx"
34 
35 //-----------------------------------------------------------------------
36 // namespace directives
37 //-----------------------------------------------------------------------
38 
39 using namespace ::rtl						;
40 using namespace ::com::sun::star::uno		;
41 using namespace ::com::sun::star::container	;
42 using namespace ::com::sun::star::lang		;
43 using namespace ::com::sun::star::registry	;
44 using namespace ::cppu					    ;
45 using com::sun::star::system::XSimpleMailClientSupplier;
46 
47 //-----------------------------------------------------------------------
48 // defines
49 //-----------------------------------------------------------------------
50 
51 #define COMP_SERVICE_NAME  "com.sun.star.system.SimpleCommandMail"
52 #define COMP_IMPL_NAME     "com.sun.star.comp.system.SimpleCommandMail"
53 
54 //-----------------------------------------------------------------------
55 //
56 //-----------------------------------------------------------------------
57 
58 namespace
59 {
60 	Reference< XInterface > SAL_CALL createInstance( const Reference< XComponentContext >& xContext )
61 	{
62 		return Reference< XInterface >( static_cast< XSimpleMailClientSupplier* >( new CmdMailSuppl( xContext ) ) );
63 	}
64 }
65 
66 //-----------------------------------------------------------------------
67 // the 3 important functions which will be exported
68 //-----------------------------------------------------------------------
69 
70 extern "C"
71 {
72 
73 //----------------------------------------------------------------------
74 // component_getImplementationEnvironment
75 //----------------------------------------------------------------------
76 
77 void SAL_CALL component_getImplementationEnvironment(
78 	const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
79 {
80 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
81 }
82 
83 //----------------------------------------------------------------------
84 // component_getFactory
85 //----------------------------------------------------------------------
86 
87 void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* /*pSrvManager*/, uno_Interface* /*pRegistryKey*/ )
88 {
89     Reference< XSingleComponentFactory > xFactory;
90 
91     if (0 == ::rtl_str_compare( pImplName, COMP_IMPL_NAME ))
92     {
93         OUString serviceName( RTL_CONSTASCII_USTRINGPARAM(COMP_SERVICE_NAME) );
94 
95         xFactory = ::cppu::createSingleComponentFactory(
96             createInstance,
97             OUString( RTL_CONSTASCII_USTRINGPARAM(COMP_IMPL_NAME) ),
98             Sequence< OUString >( &serviceName, 1 ) );
99     }
100 
101     if (xFactory.is())
102         xFactory->acquire();
103 
104     return xFactory.get();
105 }
106 
107 } // extern "C"
108