Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SC_CALLFORM_HXX
21 : #define SC_CALLFORM_HXX
22 :
23 : #include <rtl/ustring.hxx>
24 :
25 : #include <boost/ptr_container/ptr_map.hpp>
26 :
27 : #define MAXFUNCPARAM 16
28 : #define MAXARRSIZE 0xfffe
29 :
30 : #ifndef WNT
31 : #define CALLTYPE
32 : #else
33 : #define CALLTYPE __cdecl
34 : #endif
35 :
36 : extern "C" {
37 : typedef void (CALLTYPE* AdvData)( double& nHandle, void* pData );
38 : }
39 :
40 : enum ParamType
41 : {
42 : PTR_DOUBLE,
43 : PTR_STRING,
44 : PTR_DOUBLE_ARR,
45 : PTR_STRING_ARR,
46 : PTR_CELL_ARR,
47 : NONE
48 : };
49 :
50 : class ModuleData;
51 :
52 0 : class FuncData
53 : {
54 : friend class FuncCollection;
55 :
56 : const ModuleData* pModuleData;
57 : rtl::OUString aInternalName;
58 : rtl::OUString aFuncName;
59 : sal_uInt16 nNumber;
60 : sal_uInt16 nParamCount;
61 : ParamType eAsyncType;
62 : ParamType eParamType[MAXFUNCPARAM];
63 : public:
64 : FuncData(const ModuleData*pModule,
65 : const rtl::OUString& rIName,
66 : const rtl::OUString& rFName,
67 : sal_uInt16 nNo,
68 : sal_uInt16 nCount,
69 : const ParamType* peType,
70 : ParamType eType);
71 : FuncData(const FuncData& rData);
72 :
73 : const rtl::OUString& GetModuleName() const;
74 0 : const rtl::OUString& GetInternalName() const { return aInternalName; }
75 : const rtl::OUString& GetFuncName() const { return aFuncName; }
76 0 : sal_uInt16 GetParamCount() const { return nParamCount; }
77 0 : ParamType GetParamType(sal_uInt16 nIndex) const { return eParamType[nIndex]; }
78 : ParamType GetReturnType() const { return eParamType[0]; }
79 0 : ParamType GetAsyncType() const { return eAsyncType; }
80 : bool Call(void** ppParam) const;
81 : bool Unadvice(double nHandle);
82 :
83 : // name and description of parameter nParam.
84 : // nParam==0 => Desc := function description,
85 : // Name := n/a
86 : bool getParamDesc( ::rtl::OUString& aName, ::rtl::OUString& aDesc, sal_uInt16 nParam ) const;
87 : };
88 :
89 :
90 0 : class FuncCollection
91 : {
92 : typedef boost::ptr_map<rtl::OUString, FuncData> MapType;
93 : MapType maData;
94 : public:
95 : typedef MapType::const_iterator const_iterator;
96 :
97 : FuncCollection();
98 : FuncCollection(const FuncCollection& r);
99 :
100 : const FuncData* findByName(const rtl::OUString& rName) const;
101 : FuncData* findByName(const rtl::OUString& rName);
102 : void insert(FuncData* pNew);
103 :
104 : const_iterator begin() const;
105 : const_iterator end() const;
106 : };
107 :
108 :
109 : bool InitExternalFunc(const rtl::OUString& rModuleName);
110 : void ExitExternalFunc();
111 :
112 : #endif
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|