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