Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_CALLFORM_HXX
30 : : #define SC_CALLFORM_HXX
31 : :
32 : : #include <rtl/ustring.hxx>
33 : :
34 : : #include <boost/ptr_container/ptr_map.hpp>
35 : :
36 : : #define MAXFUNCPARAM 16
37 : : #define MAXARRSIZE 0xfffe
38 : :
39 : : #ifndef WNT
40 : : #define CALLTYPE
41 : : #else
42 : : #define CALLTYPE __cdecl
43 : : #endif
44 : :
45 : : extern "C" {
46 : : typedef void (CALLTYPE* AdvData)( double& nHandle, void* pData );
47 : : }
48 : :
49 : : enum ParamType
50 : : {
51 : : PTR_DOUBLE,
52 : : PTR_STRING,
53 : : PTR_DOUBLE_ARR,
54 : : PTR_STRING_ARR,
55 : : PTR_CELL_ARR,
56 : : NONE
57 : : };
58 : :
59 : : class ModuleData;
60 : :
61 : 0 : class FuncData
62 : : {
63 : : friend class FuncCollection;
64 : :
65 : : const ModuleData* pModuleData;
66 : : rtl::OUString aInternalName;
67 : : rtl::OUString aFuncName;
68 : : sal_uInt16 nNumber;
69 : : sal_uInt16 nParamCount;
70 : : ParamType eAsyncType;
71 : : ParamType eParamType[MAXFUNCPARAM];
72 : : public:
73 : : FuncData(const ModuleData*pModule,
74 : : const rtl::OUString& rIName,
75 : : const rtl::OUString& rFName,
76 : : sal_uInt16 nNo,
77 : : sal_uInt16 nCount,
78 : : const ParamType* peType,
79 : : ParamType eType);
80 : : FuncData(const FuncData& rData);
81 : :
82 : : const rtl::OUString& GetModuleName() const;
83 : 0 : const rtl::OUString& GetInternalName() const { return aInternalName; }
84 : : const rtl::OUString& GetFuncName() const { return aFuncName; }
85 : 0 : sal_uInt16 GetParamCount() const { return nParamCount; }
86 : 0 : ParamType GetParamType(sal_uInt16 nIndex) const { return eParamType[nIndex]; }
87 : : ParamType GetReturnType() const { return eParamType[0]; }
88 : 0 : ParamType GetAsyncType() const { return eAsyncType; }
89 : : bool Call(void** ppParam) const;
90 : : bool Unadvice(double nHandle);
91 : :
92 : : // name and description of parameter nParam.
93 : : // nParam==0 => Desc := function description,
94 : : // Name := n/a
95 : : bool getParamDesc( ::rtl::OUString& aName, ::rtl::OUString& aDesc, sal_uInt16 nParam ) const;
96 : : };
97 : :
98 : :
99 : 5 : class FuncCollection
100 : : {
101 : : typedef boost::ptr_map<rtl::OUString, FuncData> MapType;
102 : : MapType maData;
103 : : public:
104 : : typedef MapType::const_iterator const_iterator;
105 : :
106 : : FuncCollection();
107 : : FuncCollection(const FuncCollection& r);
108 : :
109 : : const FuncData* findByName(const rtl::OUString& rName) const;
110 : : FuncData* findByName(const rtl::OUString& rName);
111 : : void insert(FuncData* pNew);
112 : :
113 : : const_iterator begin() const;
114 : : const_iterator end() const;
115 : : };
116 : :
117 : :
118 : : bool InitExternalFunc(const rtl::OUString& rModuleName);
119 : : void ExitExternalFunc();
120 : :
121 : : #endif
122 : :
123 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|