merged tag ooo/OOO330_m14
[LibreOffice.git] / sc / inc / callform.hxx
blob58962ea18c03859a93d5ba6e880ec7d73b1aeee2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SC_CALLFORM_HXX
29 #define SC_CALLFORM_HXX
31 #include "collect.hxx"
33 //------------------------------------------------------------------------
34 #define MAXFUNCPARAM 16
35 #define MAXARRSIZE 0xfffe
37 //------------------------------------------------------------------------
38 #ifndef WIN
39 #ifndef WNT
40 #define CALLTYPE
41 #else
42 #define CALLTYPE __cdecl
43 #endif
44 #else
45 #define PASCAL _pascal
46 #define FAR _far
47 #define CALLTYPE FAR PASCAL
48 #endif
50 extern "C" {
51 typedef void (CALLTYPE* AdvData)( double& nHandle, void* pData );
54 //------------------------------------------------------------------------
55 enum ParamType
57 PTR_DOUBLE,
58 PTR_STRING,
59 PTR_DOUBLE_ARR,
60 PTR_STRING_ARR,
61 PTR_CELL_ARR,
62 NONE
65 //------------------------------------------------------------------------
66 class ModuleData;
67 class FuncData : public ScDataObject
69 friend class FuncCollection;
70 const ModuleData* pModuleData;
71 String aInternalName;
72 String aFuncName;
73 USHORT nNumber;
74 USHORT nParamCount;
75 ParamType eAsyncType;
76 ParamType eParamType[MAXFUNCPARAM];
77 private:
78 FuncData(const String& rIName);
79 public:
80 FuncData(const ModuleData*pModule,
81 const String& rIName,
82 const String& rFName,
83 USHORT nNo,
84 USHORT nCount,
85 const ParamType* peType,
86 ParamType eType);
87 FuncData(const FuncData& rData);
88 virtual ScDataObject* Clone() const { return new FuncData(*this); }
90 const String& GetModuleName() const;
91 const String& GetInternalName() const { return aInternalName; }
92 const String& GetFuncName() const { return aFuncName; }
93 USHORT GetParamCount() const { return nParamCount; }
94 ParamType GetParamType(USHORT nIndex) const { return eParamType[nIndex]; }
95 ParamType GetReturnType() const { return eParamType[0]; }
96 ParamType GetAsyncType() const { return eAsyncType; }
97 BOOL Call(void** ppParam);
98 BOOL Unadvice(double nHandle);
100 // Name und Beschreibung des Parameters nParam.
101 // nParam==0 => Desc := Funktions-Beschreibung,
102 // Name := n/a
103 BOOL GetParamDesc( String& aName, String& aDesc, USHORT nParam );
107 //------------------------------------------------------------------------
108 class FuncCollection : public ScSortedCollection
110 public:
111 FuncCollection(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE) : ScSortedCollection ( nLim, nDel, bDup ) {}
112 FuncCollection(const FuncCollection& rFuncCollection) : ScSortedCollection ( rFuncCollection ) {}
114 virtual ScDataObject* Clone() const { return new FuncCollection(*this); }
115 FuncData* operator[]( const USHORT nIndex) const {return (FuncData*)At(nIndex);}
116 virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
117 BOOL SearchFunc( const String& rName, USHORT& rIndex ) const;
121 BOOL InitExternalFunc(const rtl::OUString& rModuleName);
122 void ExitExternalFunc();
124 #endif