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