1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2008 by Sun Microsystems, Inc.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * $RCSfile: service.cxx,v $
10  * $Revision: 1.0 $
11  *
12  * This file is part of OpenOffice.org.
13  *
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.
17  *
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).
23  *
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.
28  *
29  ************************************************************************/
30 
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_scripting.hxx"
33 #include "cppuhelper/implementationentry.hxx"
34 #include "com/sun/star/lang/XMultiServiceFactory.hpp"
35 #include "com/sun/star/registry/XRegistryKey.hpp"
36 
37 // =============================================================================
38 // component exports
39 // =============================================================================
40 using namespace ::com::sun::star;
41 using namespace ::com::sun::star::uno;
42 
43 namespace evtlstner
44 {
45     // =============================================================================
46     // component operations
47     // =============================================================================
48 
49     uno::Reference< XInterface > SAL_CALL create(
50         Reference< XComponentContext > const & xContext )
51         SAL_THROW( () );
52 
53     // -----------------------------------------------------------------------------
54 
55     ::rtl::OUString SAL_CALL getImplementationName();
56 
57     Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
58 
59     Reference<XInterface> SAL_CALL create(
60         Sequence<Any> const &, Reference<XComponentContext> const & );
61 } // end evtlstner
62 
63 namespace ooevtdescgen
64 {
65     // =============================================================================
66     // component operations
67     // =============================================================================
68 
69     uno::Reference< XInterface > SAL_CALL create(
70         Reference< XComponentContext > const & xContext )
71         SAL_THROW( () );
72 
73     // -----------------------------------------------------------------------------
74 
75     ::rtl::OUString SAL_CALL getImplementationName();
76 
77     Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
78 
79     Reference<XInterface> SAL_CALL create(
80         Sequence<Any> const &, Reference<XComponentContext> const & );
81 } // end ooevtdescgen
82 
83 
84 
85     // =============================================================================
86 
87     const ::cppu::ImplementationEntry s_component_entries [] =
88     {
89         {
90             ::evtlstner::create, ::evtlstner::getImplementationName,
91             ::evtlstner::getSupportedServiceNames,
92             ::cppu::createSingleComponentFactory,
93             0, 0
94         },
95         {
96             ::ooevtdescgen::create, ::ooevtdescgen::getImplementationName,
97             ::ooevtdescgen::getSupportedServiceNames,
98             ::cppu::createSingleComponentFactory,
99             0, 0
100         },
101         { 0, 0, 0, 0, 0, 0 }
102     };
103 
104 extern "C"
105 {
106     SAL_DLLPUBLIC_EXPORT  void SAL_CALL component_getImplementationEnvironment(
107         const sal_Char ** ppEnvTypeName, uno_Environment ** )
108     {
109         OSL_TRACE("In component_getImplementationEnv");
110         *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
111     }
112 
113     SAL_DLLPUBLIC_EXPORT  void * SAL_CALL component_getFactory(
114         const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
115         registry::XRegistryKey * pRegistryKey )
116     {
117         OSL_TRACE("In component_getFactory");
118         return ::cppu::component_getFactoryHelper(
119             pImplName, pServiceManager, pRegistryKey, s_component_entries );
120     }
121 }
122