25#include <osl/module.hxx>
43typedef void (
CALLTYPE*
ExFuncPtr9)(
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*);
44typedef void (
CALLTYPE*
ExFuncPtr10)(
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*);
45typedef void (
CALLTYPE*
ExFuncPtr11)(
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*);
46typedef void (
CALLTYPE*
ExFuncPtr12)(
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*);
47typedef void (
CALLTYPE*
ExFuncPtr13)(
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*);
48typedef void (
CALLTYPE*
ExFuncPtr14)(
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*);
49typedef void (
CALLTYPE*
ExFuncPtr15)(
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*);
50typedef void (
CALLTYPE*
ExFuncPtr16)(
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*,
void*);
54 (sal_uInt16& nNo,
char* pFuncName, sal_uInt16& nParamCount,
ParamType* peType,
char* pInternalName);
58 (sal_uInt16& nNo, sal_uInt16& nParam,
char*
pName,
char* pDesc );
68#ifndef DISABLE_DYNLOADING
74constexpr OUStringLiteral
ADVICE =
u"Advice";
100 pModuleData (pModule),
101 aInternalName (
std::move(aIName)),
102 aFuncName (
std::move(aFName)),
112 pModuleData (rData.pModuleData),
113 aInternalName (rData.aInternalName),
114 aFuncName (rData.aFuncName),
115 nNumber (rData.nNumber),
116 nParamCount (rData.nParamCount),
117 eAsyncType (rData.eAsyncType)
125class ModuleCollection
127 typedef std::map<OUString, std::unique_ptr<ModuleData>> MapType;
130 ModuleCollection() {}
132 const ModuleData* findByName(
const OUString& rName)
const;
137const ModuleData* ModuleCollection::findByName(
const OUString& rName)
const
139 MapType::const_iterator it = m_Data.find(rName);
140 return it == m_Data.end() ? nullptr : it->second.get();
143void ModuleCollection::insert(
ModuleData* pNew)
149 m_Data.insert(std::make_pair(aName, std::unique_ptr<ModuleData>(pNew)));
152void ModuleCollection::clear()
157ModuleCollection aModuleCollection;
163#ifdef DISABLE_DYNLOADING
168 const ModuleData* pTemp = aModuleCollection.findByName(rModuleName);
172 OUString aNP = rModuleName;
174 std::unique_ptr<osl::Module>
pLib(
new osl::Module( aNP ));
180 if ((fpGetCount ==
nullptr) || (fpGetData ==
nullptr))
183 oslGenericFunction fpIsAsync =
pLib->getFunctionSymbol(
ISASYNC);
184 oslGenericFunction fpAdvice =
pLib->getFunctionSymbol(
ADVICE);
185 oslGenericFunction fpSetLanguage =
pLib->getFunctionSymbol(
SETLANGUAGE);
189 sal_uInt16 nLanguage =
static_cast<sal_uInt16
>(eLanguage);
195 aModuleCollection.insert(pModuleData);
205 char cInternalName[256];
206 sal_uInt16 nParamCount;
211 cInternalName[0] = 0;
213 for (
ParamType & rParamType : eParamType)
217 (*
reinterpret_cast<GetFuncDataPtr>(fpGetData))(
i, cFuncName, nParamCount,
218 eParamType, cInternalName);
221 (*
reinterpret_cast<IsAsync>(fpIsAsync))(
i, &eAsyncType);
223 (*
reinterpret_cast<Advice>(fpAdvice))(
i, pfCallBack );
225 OUString aInternalName( cInternalName, strlen(cInternalName), osl_getThreadTextEncoding() );
226 OUString aFuncName( cFuncName, strlen(cFuncName), osl_getThreadTextEncoding() );
234 pLegacyFuncCol->
insert(pLegacyFuncData);
242 aModuleCollection.clear();
247#ifdef DISABLE_DYNLOADING
251 oslGenericFunction fProc =
pLib->getFunctionSymbol(
aFuncName);
252 if (fProc ==
nullptr)
258 (*
reinterpret_cast<ExFuncPtr1>(fProc))(ppParam[0]);
261 (*
reinterpret_cast<ExFuncPtr2>(fProc))(ppParam[0], ppParam[1]);
264 (*
reinterpret_cast<ExFuncPtr3>(fProc))(ppParam[0], ppParam[1], ppParam[2]);
267 (*
reinterpret_cast<ExFuncPtr4>(fProc))(ppParam[0], ppParam[1], ppParam[2], ppParam[3]);
270 (*
reinterpret_cast<ExFuncPtr5>(fProc))(ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4]);
273 (*
reinterpret_cast<ExFuncPtr6>(fProc))(ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5]);
276 (*
reinterpret_cast<ExFuncPtr7>(fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
280 (*
reinterpret_cast<ExFuncPtr8>(fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
281 ppParam[6], ppParam[7]);
284 (*
reinterpret_cast<ExFuncPtr9>(fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
285 ppParam[6], ppParam[7], ppParam[8]);
288 (*
reinterpret_cast<ExFuncPtr10>(fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
289 ppParam[6], ppParam[7], ppParam[8], ppParam[9]);
292 (*
reinterpret_cast<ExFuncPtr11>(fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
293 ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10]);
296 (*
reinterpret_cast<ExFuncPtr12>(fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
297 ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10], ppParam[11]);
300 (*
reinterpret_cast<ExFuncPtr13>(fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
301 ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10], ppParam[11],
305 (*
reinterpret_cast<ExFuncPtr14>(fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
306 ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10], ppParam[11],
307 ppParam[12], ppParam[13]);
310 (*
reinterpret_cast<ExFuncPtr15>(fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
311 ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10], ppParam[11],
312 ppParam[12], ppParam[13], ppParam[14]);
315 (*
reinterpret_cast<ExFuncPtr16>(fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
316 ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10], ppParam[11],
317 ppParam[12], ppParam[13], ppParam[14], ppParam[15]);
326#ifdef DISABLE_DYNLOADING
330 oslGenericFunction fProc =
pLib->getFunctionSymbol(
UNADVICE);
331 if (fProc !=
nullptr)
345#ifdef DISABLE_DYNLOADING
355 if ( fProc !=
nullptr )
359 *pcName = *pcDesc = 0;
361 reinterpret_cast< ::
GetParamDesc>(fProc)( nFuncNo, nParam, pcName, pcDesc );
362 aName = OUString( pcName, 256, osl_getThreadTextEncoding() );
363 aDesc = OUString( pcDesc, 256, osl_getThreadTextEncoding() );
378 for (
auto const& it : r.
m_Data)
380 m_Data.insert(std::make_pair(it.first, std::make_unique<LegacyFuncData>(*it.second)));
386 MapType::const_iterator it =
m_Data.find(rName);
387 return it ==
m_Data.end() ? nullptr : it->second.get();
392 MapType::iterator it =
m_Data.find(rName);
393 return it ==
m_Data.end() ? nullptr : it->second.get();
399 m_Data.insert(std::make_pair(
aName, std::unique_ptr<LegacyFuncData>(pNew)));
void CALLTYPE ScAddInAsyncCallBack(double &nHandle, void *pData)
const LanguageTag & GetUILanguageTag() const
static const AllSettings & GetSettings()
LanguageType getLanguageType(bool bResolveSystem=true) const
const_iterator begin() const
const LegacyFuncData * findByName(const OUString &rName) const
void insert(LegacyFuncData *pNew)
const_iterator end() const
MapType::const_iterator const_iterator
LegacyFuncData(const ModuleData *pModule, OUString aIName, OUString aFName, sal_uInt16 nNo, sal_uInt16 nCount, const ParamType *peType, ParamType eType)
void getParamDesc(OUString &aName, OUString &aDesc, sal_uInt16 nParam) const
name and description of parameter nParam.
void Call(void **ppParam) const
ParamType eParamType[MAXFUNCPARAM]
const OUString & GetInternalName() const
void Unadvice(double nHandle)
const OUString & GetModuleName() const
const ModuleData * pModuleData
const OUString & GetName() const
osl::Module * GetInstance() const
std::unique_ptr< osl::Module > pInstance
ModuleData(OUString aStr, std::unique_ptr< osl::Module > pInst)
friend class ModuleCollection
ModuleData(const ModuleData &)=delete
const ModuleData & operator=(const ModuleData &)=delete
static LegacyFuncCollection * GetLegacyFuncCollection()