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_i18npool.hxx"
26 
27 #include <assert.h>
28 #include <textconversion.hxx>
29 
30 using namespace com::sun::star::uno;
31 using namespace rtl;
32 
33 namespace com { namespace sun { namespace star { namespace i18n {
34 
thisModule()35 extern "C" { static void SAL_CALL thisModule() {} }
36 
TextConversion()37 TextConversion::TextConversion()
38 {
39 #ifdef SAL_DLLPREFIX
40     OUString lib=OUString::createFromAscii( SAL_DLLPREFIX "textconv_dict" SAL_DLLEXTENSION);
41 #else
42     OUString lib=OUString::createFromAscii( "textconv_dict" SAL_DLLEXTENSION);
43 #endif
44     hModule = osl_loadModuleRelative(
45         &thisModule, lib.pData, SAL_LOADMODULE_DEFAULT );
46 }
47 
~TextConversion()48 TextConversion::~TextConversion()
49 {
50     if (hModule) osl_unloadModule(hModule);
51 }
52 
nullFunc()53 static void* nullFunc()
54 {
55     return NULL;
56 }
57 
58 oslGenericFunction SAL_CALL
getFunctionBySymbol(const sal_Char * func)59 TextConversion::getFunctionBySymbol(const sal_Char* func)
60 {
61     if (hModule)
62         return osl_getFunctionSymbol(hModule, OUString::createFromAscii(func).pData);
63     else
64         return reinterpret_cast< oslGenericFunction >(nullFunc);
65 }
66 
67 OUString SAL_CALL
getImplementationName()68 TextConversion::getImplementationName() throw( RuntimeException )
69 {
70     return OUString::createFromAscii(implementationName);
71 }
72 
73 sal_Bool SAL_CALL
supportsService(const OUString & rServiceName)74 TextConversion::supportsService(const OUString& rServiceName) throw( RuntimeException )
75 {
76     return rServiceName.equalsAscii(implementationName);
77 }
78 
79 Sequence< OUString > SAL_CALL
getSupportedServiceNames()80 TextConversion::getSupportedServiceNames() throw( RuntimeException )
81 {
82     Sequence< OUString > aRet(1);
83     aRet[0] = OUString::createFromAscii(implementationName);
84     return aRet;
85 }
86 
87 } } } }
88