1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_SOURCE_CORE_INC_ADIASYNC_HXX
21 #define INCLUDED_SC_SOURCE_CORE_INC_ADIASYNC_HXX
23 #include <svl/broadcast.hxx>
26 #include "callform.hxx"
29 void CALLTYPE
ScAddInAsyncCallBack( double& nHandle
, void* pData
);
33 class ScAddInDocs
: public std::set
<ScDocument
*> {};
35 class ScAddInAsync
: public SvtBroadcaster
40 double nVal
; // current value
43 ScAddInDocs
* pDocs
; // List of using documents
44 FuncData
* mpFuncData
; // Pointer to data in collection
45 sal_uLong nHandle
; // is casted from double to sal_uLong
46 ParamType meType
; // result of type PTR_DOUBLE or PTR_STRING
47 bool bValid
; // is value valid?
50 // cTor only if ScAddInAsync::Get fails.
51 // nIndex: Index from FunctionCollection
52 ScAddInAsync(sal_uLong nHandle
, FuncData
* pFuncData
, ScDocument
* pDoc
);
53 // default-cTor only for that single, global aSeekObj!
55 virtual ~ScAddInAsync();
56 static ScAddInAsync
* Get( sal_uLong nHandle
);
57 static void CallBack( sal_uLong nHandle
, void* pData
);
58 static void RemoveDocument( ScDocument
* pDocument
);
59 bool IsValid() const { return bValid
; }
60 ParamType
GetType() const { return meType
; }
61 double GetValue() const { return nVal
; }
62 const OUString
& GetString() const { return *pStr
; }
63 bool HasDocument( ScDocument
* pDoc
) const
64 { return pDocs
->find( pDoc
) != pDocs
->end(); }
65 void AddDocument( ScDocument
* pDoc
) { pDocs
->insert( pDoc
); }
67 // Comparators for PtrArrSort
68 bool operator< ( const ScAddInAsync
& r
) const { return nHandle
< r
.nHandle
; }
69 bool operator==( const ScAddInAsync
& r
) const { return nHandle
== r
.nHandle
; }
72 struct CompareScAddInAsync
74 bool operator()( ScAddInAsync
* const& lhs
, ScAddInAsync
* const& rhs
) const { return (*lhs
)<(*rhs
); }
76 class ScAddInAsyncs
: public std::set
<ScAddInAsync
*, CompareScAddInAsync
> {};
78 extern ScAddInAsyncs theAddInAsyncTbl
; // in adiasync.cxx
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */