1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: adiasync.hxx,v $
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_ADIASYNC_HXX
32 #define SC_ADIASYNC_HXX
34 #include <svtools/broadcast.hxx>
35 #include <svtools/svarray.hxx>
37 #include "callform.hxx"
40 void CALLTYPE
ScAddInAsyncCallBack( double& nHandle
, void* pData
);
45 typedef ScAddInAsync
* ScAddInAsyncPtr
;
46 SV_DECL_PTRARR_SORT( ScAddInAsyncs
, ScAddInAsyncPtr
, 4, 4 )
47 extern ScAddInAsyncs theAddInAsyncTbl
; // in adiasync.cxx
50 typedef ScDocument
* ScAddInDocPtr
;
51 SV_DECL_PTRARR_SORT( ScAddInDocs
, ScAddInDocPtr
, 1, 1 )
55 class ScAddInAsync
: public SvtBroadcaster
60 double nVal
; // aktueller Wert
63 ScAddInDocs
* pDocs
; // Liste der benutzenden Dokumente
64 FuncData
* pFuncData
; // Zeiger auf die Daten in der Collection
65 ULONG nHandle
; // wird von double auf ULONG gecasted
66 ParamType eType
; // PTR_DOUBLE oder PTR_STRING Ergebnis
67 BOOL bValid
; // ob Wert gueltig
70 // cTor nur wenn ScAddInAsync::Get fehlschlaegt!
71 // nIndex: Index aus der FunctionCollection
72 ScAddInAsync( ULONG nHandle
, USHORT nIndex
,
74 // default-cTor nur fuer das eine globale aSeekObj !!!
76 virtual ~ScAddInAsync();
77 static ScAddInAsync
* Get( ULONG nHandle
);
78 static void CallBack( ULONG nHandle
, void* pData
);
79 static void RemoveDocument( ScDocument
* pDocument
);
80 BOOL
IsValid() const { return bValid
; }
81 ParamType
GetType() const { return eType
; }
82 double GetValue() const { return nVal
; }
83 const String
& GetString() const { return *pStr
; }
84 BOOL
HasDocument( ScDocument
* pDoc
) const
85 { return pDocs
->Seek_Entry( pDoc
); }
86 void AddDocument( ScDocument
* pDoc
) { pDocs
->Insert( pDoc
); }
88 // Vergleichsoperatoren fuer PtrArrSort
89 BOOL
operator < ( const ScAddInAsync
& r
) { return nHandle
< r
.nHandle
; }
90 BOOL
operator ==( const ScAddInAsync
& r
) { return nHandle
== r
.nHandle
; }