1449ab281SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3449ab281SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4449ab281SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5449ab281SAndrew Rist  * distributed with this work for additional information
6449ab281SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7449ab281SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8449ab281SAndrew Rist  * "License"); you may not use this file except in compliance
9449ab281SAndrew Rist  * with the License.  You may obtain a copy of the License at
10449ab281SAndrew Rist  *
11449ab281SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12449ab281SAndrew Rist  *
13449ab281SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14449ab281SAndrew Rist  * software distributed under the License is distributed on an
15449ab281SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16449ab281SAndrew Rist  * KIND, either express or implied.  See the License for the
17449ab281SAndrew Rist  * specific language governing permissions and limitations
18449ab281SAndrew Rist  * under the License.
19449ab281SAndrew Rist  *
20449ab281SAndrew Rist  *************************************************************/
21449ab281SAndrew Rist 
22449ab281SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_i18npool.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <assert.h>
28cdf0e10cSrcweir #include <textconversion.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir using namespace com::sun::star::uno;
31cdf0e10cSrcweir using namespace rtl;
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n {
34cdf0e10cSrcweir 
thisModule()35cdf0e10cSrcweir extern "C" { static void SAL_CALL thisModule() {} }
36cdf0e10cSrcweir 
TextConversion()37cdf0e10cSrcweir TextConversion::TextConversion()
38cdf0e10cSrcweir {
39cdf0e10cSrcweir #ifdef SAL_DLLPREFIX
40*6f51c329SHerbert Dürr     OUString lib=OUString::createFromAscii( SAL_DLLPREFIX "textconv_dict" SAL_DLLEXTENSION);
41cdf0e10cSrcweir #else
42*6f51c329SHerbert Dürr     OUString lib=OUString::createFromAscii( "textconv_dict" SAL_DLLEXTENSION);
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir     hModule = osl_loadModuleRelative(
45cdf0e10cSrcweir         &thisModule, lib.pData, SAL_LOADMODULE_DEFAULT );
46cdf0e10cSrcweir }
47cdf0e10cSrcweir 
~TextConversion()48cdf0e10cSrcweir TextConversion::~TextConversion()
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     if (hModule) osl_unloadModule(hModule);
51cdf0e10cSrcweir }
52cdf0e10cSrcweir 
nullFunc()53cdf0e10cSrcweir static void* nullFunc()
54cdf0e10cSrcweir {
55cdf0e10cSrcweir     return NULL;
56cdf0e10cSrcweir }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir oslGenericFunction SAL_CALL
getFunctionBySymbol(const sal_Char * func)59cdf0e10cSrcweir TextConversion::getFunctionBySymbol(const sal_Char* func)
60cdf0e10cSrcweir {
61cdf0e10cSrcweir     if (hModule)
62cdf0e10cSrcweir         return osl_getFunctionSymbol(hModule, OUString::createFromAscii(func).pData);
63cdf0e10cSrcweir     else
64cdf0e10cSrcweir         return reinterpret_cast< oslGenericFunction >(nullFunc);
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir OUString SAL_CALL
getImplementationName()68cdf0e10cSrcweir TextConversion::getImplementationName() throw( RuntimeException )
69cdf0e10cSrcweir {
70cdf0e10cSrcweir     return OUString::createFromAscii(implementationName);
71cdf0e10cSrcweir }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir sal_Bool SAL_CALL
supportsService(const OUString & rServiceName)74cdf0e10cSrcweir TextConversion::supportsService(const OUString& rServiceName) throw( RuntimeException )
75cdf0e10cSrcweir {
76cdf0e10cSrcweir     return rServiceName.equalsAscii(implementationName);
77cdf0e10cSrcweir }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir Sequence< OUString > SAL_CALL
getSupportedServiceNames()80cdf0e10cSrcweir TextConversion::getSupportedServiceNames() throw( RuntimeException )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir     Sequence< OUString > aRet(1);
83cdf0e10cSrcweir     aRet[0] = OUString::createFromAscii(implementationName);
84cdf0e10cSrcweir     return aRet;
85cdf0e10cSrcweir }
86cdf0e10cSrcweir 
87cdf0e10cSrcweir } } } }
88