Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_ADIASYNC_HXX
30 : : #define SC_ADIASYNC_HXX
31 : :
32 : : #include <svl/broadcast.hxx>
33 : : #include <set>
34 : :
35 : : #include "callform.hxx"
36 : :
37 : : extern "C" {
38 : : void CALLTYPE ScAddInAsyncCallBack( double& nHandle, void* pData );
39 : : }
40 : :
41 : :
42 : : class ScDocument;
43 : 0 : class ScAddInDocs : public std::set<ScDocument*> {};
44 : :
45 : : class String;
46 : :
47 : : class ScAddInAsync : public SvtBroadcaster
48 : : {
49 : : private:
50 : : union
51 : : {
52 : : double nVal; // aktueller Wert
53 : : String* pStr;
54 : : };
55 : : ScAddInDocs* pDocs; // Liste der benutzenden Dokumente
56 : : FuncData* mpFuncData; // Zeiger auf die Daten in der Collection
57 : : sal_uLong nHandle; // wird von double auf sal_uLong gecasted
58 : : ParamType meType; // PTR_DOUBLE oder PTR_STRING Ergebnis
59 : : sal_Bool bValid; // ob Wert gueltig
60 : :
61 : : public:
62 : : // cTor nur wenn ScAddInAsync::Get fehlschlaegt!
63 : : // nIndex: Index aus der FunctionCollection
64 : : ScAddInAsync(sal_uLong nHandle, FuncData* pFuncData, ScDocument* pDoc);
65 : : // default-cTor nur fuer das eine globale aSeekObj !!!
66 : : ScAddInAsync();
67 : : virtual ~ScAddInAsync();
68 : : static ScAddInAsync* Get( sal_uLong nHandle );
69 : : static void CallBack( sal_uLong nHandle, void* pData );
70 : : static void RemoveDocument( ScDocument* pDocument );
71 : 0 : sal_Bool IsValid() const { return bValid; }
72 : 0 : ParamType GetType() const { return meType; }
73 : 0 : double GetValue() const { return nVal; }
74 : 0 : const String& GetString() const { return *pStr; }
75 : 0 : bool HasDocument( ScDocument* pDoc ) const
76 [ # # ]: 0 : { return pDocs->find( pDoc ) != pDocs->end(); }
77 : 0 : void AddDocument( ScDocument* pDoc ) { pDocs->insert( pDoc ); }
78 : :
79 : : // Vergleichsoperatoren fuer PtrArrSort
80 : 0 : bool operator< ( const ScAddInAsync& r ) const { return nHandle < r.nHandle; }
81 : : bool operator==( const ScAddInAsync& r ) const { return nHandle == r.nHandle; }
82 : : };
83 : :
84 : : struct CompareScAddInAsync
85 : : {
86 : 0 : bool operator()( ScAddInAsync* const& lhs, ScAddInAsync* const& rhs ) const { return (*lhs)<(*rhs); }
87 : : };
88 : 102 : class ScAddInAsyncs : public std::set<ScAddInAsync*, CompareScAddInAsync> {};
89 : :
90 : : extern ScAddInAsyncs theAddInAsyncTbl; // in adiasync.cxx
91 : :
92 : :
93 : :
94 : : #endif
95 : :
96 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|