xref: /AOO41X/main/dbaccess/source/ext/adabas/Aservices.cxx (revision 96de54900b79e13b861fbc62cbf36018b54e21b7)
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 #ifndef _CPPUHELPER_FACTORY_HXX_
25 #include <cppuhelper/factory.hxx>
26 #endif
27 #ifndef _OSL_DIAGNOSE_H_
28 #include <osl/diagnose.h>
29 #endif
30 #ifndef _EXTENSIONS_COMPONENT_MODULE_HXX_
31 #include "Acomponentmodule.hxx"
32 #endif
33 
34 
35 /********************************************************************************************/
36 
37 using namespace ::rtl;
38 using namespace ::adabasui;
39 using namespace ::com::sun::star::uno;
40 using namespace ::com::sun::star::lang;
41 using namespace ::com::sun::star::registry;
42 
43 //***************************************************************************************
44 //
45 // registry functions
46 extern "C" void SAL_CALL createRegistryInfo_OAdabasCreateDialog();
47 
48 //***************************************************************************************
createRegistryInfo_adabasui()49 extern "C" void SAL_CALL createRegistryInfo_adabasui()
50 {
51     static sal_Bool bInit = sal_False;
52     if (!bInit)
53     {
54         createRegistryInfo_OAdabasCreateDialog();
55         ::adabasui::OModule::setResourceFilePrefix("adabasui");
56         bInit = sal_True;
57     }
58 }
59 
60 //---------------------------------------------------------------------------------------
61 
62 extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)63 component_getImplementationEnvironment(
64                 const sal_Char  **ppEnvTypeName,
65                 uno_Environment **
66             )
67 {
68     createRegistryInfo_adabasui();
69     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
70 }
71 
72 //---------------------------------------------------------------------------------------
component_getFactory(const sal_Char * pImplementationName,void * pServiceManager,void *)73 extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
74                     const sal_Char* pImplementationName,
75                     void* pServiceManager,
76                     void* /*pRegistryKey*/)
77 {
78     Reference< XInterface > xRet;
79     if (pServiceManager && pImplementationName)
80     {
81         xRet = OModule::getComponentFactory(
82             ::rtl::OUString::createFromAscii(pImplementationName),
83             static_cast< XMultiServiceFactory* >(pServiceManager));
84     }
85 
86     if (xRet.is())
87         xRet->acquire();
88     return xRet.get();
89 };
90