xref: /AOO41X/main/extensions/source/preload/services.cxx (revision 2a97ec55f1442d65917e8c8b82a55ab76c9ff676)
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_extensions.hxx"
26 #include "componentmodule.hxx"
27 
28 //---------------------------------------------------------------------------------------
29 
30 using namespace ::rtl;
31 using namespace ::com::sun::star::uno;
32 using namespace ::com::sun::star::lang;
33 using namespace ::com::sun::star::registry;
34 
35 //---------------------------------------------------------------------------------------
36 
37 extern "C" void SAL_CALL createRegistryInfo_OEMPreloadDialog();
38 
39 //---------------------------------------------------------------------------------------
40 
preload_initializeModule()41 extern "C" void SAL_CALL preload_initializeModule()
42 {
43     static sal_Bool s_bInit = sal_False;
44     if (!s_bInit)
45     {
46         createRegistryInfo_OEMPreloadDialog();
47         ::preload::OModule::setResourceFilePrefix("preload");
48         s_bInit = sal_True;
49     }
50 }
51 
52 //---------------------------------------------------------------------------------------
53 
54 extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)55 component_getImplementationEnvironment(
56                 const sal_Char  **ppEnvTypeName,
57                 uno_Environment **  /*ppEnv*/
58             )
59 {
60     preload_initializeModule();
61     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
62 }
63 
64 //---------------------------------------------------------------------------------------
component_getFactory(const sal_Char * pImplementationName,void * pServiceManager,void *)65 extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
66                     const sal_Char* pImplementationName,
67                     void* pServiceManager,
68                     void* /*pRegistryKey*/)
69 {
70     Reference< XInterface > xRet;
71     if (pServiceManager && pImplementationName)
72     {
73         xRet = ::preload::OModule::getComponentFactory(
74             ::rtl::OUString::createFromAscii(pImplementationName),
75             static_cast< XMultiServiceFactory* >(pServiceManager));
76     }
77 
78     if (xRet.is())
79         xRet->acquire();
80     return xRet.get();
81 };
82 
83