xref: /AOO41X/main/sc/inc/callform.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_CALLFORM_HXX
25cdf0e10cSrcweir #define SC_CALLFORM_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "collect.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir //------------------------------------------------------------------------
30cdf0e10cSrcweir #define MAXFUNCPARAM    16
31cdf0e10cSrcweir #define MAXARRSIZE      0xfffe
32cdf0e10cSrcweir 
33cdf0e10cSrcweir //------------------------------------------------------------------------
34cdf0e10cSrcweir #ifndef WNT
35cdf0e10cSrcweir #define CALLTYPE
36cdf0e10cSrcweir #else
37cdf0e10cSrcweir #define CALLTYPE            __cdecl
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir 
40cdf0e10cSrcweir extern "C" {
41cdf0e10cSrcweir typedef void (CALLTYPE* AdvData)( double& nHandle, void* pData );
42cdf0e10cSrcweir }
43cdf0e10cSrcweir 
44cdf0e10cSrcweir //------------------------------------------------------------------------
45cdf0e10cSrcweir enum ParamType
46cdf0e10cSrcweir {
47cdf0e10cSrcweir     PTR_DOUBLE,
48cdf0e10cSrcweir     PTR_STRING,
49cdf0e10cSrcweir     PTR_DOUBLE_ARR,
50cdf0e10cSrcweir     PTR_STRING_ARR,
51cdf0e10cSrcweir     PTR_CELL_ARR,
52cdf0e10cSrcweir     NONE
53cdf0e10cSrcweir };
54cdf0e10cSrcweir 
55cdf0e10cSrcweir //------------------------------------------------------------------------
56cdf0e10cSrcweir class ModuleData;
57cdf0e10cSrcweir class FuncData : public ScDataObject
58cdf0e10cSrcweir {
59cdf0e10cSrcweir friend class FuncCollection;
60cdf0e10cSrcweir     const ModuleData* pModuleData;
61cdf0e10cSrcweir     String      aInternalName;
62cdf0e10cSrcweir     String      aFuncName;
63cdf0e10cSrcweir     sal_uInt16      nNumber;
64cdf0e10cSrcweir     sal_uInt16      nParamCount;
65cdf0e10cSrcweir     ParamType   eAsyncType;
66cdf0e10cSrcweir     ParamType   eParamType[MAXFUNCPARAM];
67cdf0e10cSrcweir private:
68cdf0e10cSrcweir     FuncData(const String& rIName);
69cdf0e10cSrcweir public:
70cdf0e10cSrcweir     FuncData(const ModuleData*pModule,
71cdf0e10cSrcweir              const String&    rIName,
72cdf0e10cSrcweir              const String&    rFName,
73cdf0e10cSrcweir                    sal_uInt16     nNo,
74cdf0e10cSrcweir                    sal_uInt16     nCount,
75cdf0e10cSrcweir              const ParamType* peType,
76cdf0e10cSrcweir                    ParamType  eType);
77cdf0e10cSrcweir     FuncData(const FuncData& rData);
Clone() const78cdf0e10cSrcweir     virtual ScDataObject*   Clone() const { return new FuncData(*this); }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     const   String&     GetModuleName() const;
GetInternalName() const81cdf0e10cSrcweir     const   String&     GetInternalName() const { return aInternalName; }
GetFuncName() const82cdf0e10cSrcweir     const   String&     GetFuncName() const { return aFuncName; }
GetParamCount() const83cdf0e10cSrcweir             sal_uInt16      GetParamCount() const { return nParamCount; }
GetParamType(sal_uInt16 nIndex) const84cdf0e10cSrcweir             ParamType   GetParamType(sal_uInt16 nIndex) const { return eParamType[nIndex]; }
GetReturnType() const85cdf0e10cSrcweir             ParamType   GetReturnType() const { return eParamType[0]; }
GetAsyncType() const86cdf0e10cSrcweir             ParamType   GetAsyncType() const { return eAsyncType; }
87cdf0e10cSrcweir             sal_Bool        Call(void** ppParam);
88cdf0e10cSrcweir             sal_Bool        Unadvice(double nHandle);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir                         // Name und Beschreibung des Parameters nParam.
91cdf0e10cSrcweir                         // nParam==0 => Desc := Funktions-Beschreibung,
92cdf0e10cSrcweir                         // Name := n/a
93cdf0e10cSrcweir             sal_Bool        GetParamDesc( String& aName, String& aDesc, sal_uInt16 nParam );
94cdf0e10cSrcweir };
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 
97cdf0e10cSrcweir //------------------------------------------------------------------------
98cdf0e10cSrcweir class FuncCollection : public ScSortedCollection
99cdf0e10cSrcweir {
100cdf0e10cSrcweir public:
FuncCollection(sal_uInt16 nLim=4,sal_uInt16 nDel=4,sal_Bool bDup=sal_False)101cdf0e10cSrcweir     FuncCollection(sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = sal_False) : ScSortedCollection ( nLim, nDel, bDup ) {}
FuncCollection(const FuncCollection & rFuncCollection)102cdf0e10cSrcweir     FuncCollection(const FuncCollection& rFuncCollection) : ScSortedCollection ( rFuncCollection ) {}
103cdf0e10cSrcweir 
Clone() const104cdf0e10cSrcweir     virtual ScDataObject*   Clone() const { return new FuncCollection(*this); }
operator [](const sal_uInt16 nIndex) const105cdf0e10cSrcweir             FuncData*   operator[]( const sal_uInt16 nIndex) const {return (FuncData*)At(nIndex);}
106cdf0e10cSrcweir     virtual short       Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
107cdf0e10cSrcweir             sal_Bool        SearchFunc( const String& rName, sal_uInt16& rIndex ) const;
108cdf0e10cSrcweir };
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 
111cdf0e10cSrcweir sal_Bool InitExternalFunc(const rtl::OUString& rModuleName);
112cdf0e10cSrcweir void ExitExternalFunc();
113cdf0e10cSrcweir 
114cdf0e10cSrcweir #endif
115