LCOV - code coverage report
Current view: top level - libreoffice/sc/source/core/inc - adiasync.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 11 9.1 %
Date: 2012-12-27 Functions: 2 12 16.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef SC_ADIASYNC_HXX
      21             : #define SC_ADIASYNC_HXX
      22             : 
      23             : #include <svl/broadcast.hxx>
      24             : #include <set>
      25             : 
      26             : #include "callform.hxx"
      27             : 
      28             : extern "C" {
      29             : void CALLTYPE ScAddInAsyncCallBack( double& nHandle, void* pData );
      30             : }
      31             : 
      32             : class ScDocument;
      33           0 : class ScAddInDocs : public std::set<ScDocument*> {};
      34             : 
      35             : class String;
      36             : 
      37             : class ScAddInAsync : public SvtBroadcaster
      38             : {
      39             : private:
      40             :     union
      41             :     {
      42             :         double      nVal;               // current value
      43             :         String*     pStr;
      44             :     };
      45             :     ScAddInDocs*    pDocs;              // List of using documents
      46             :     FuncData*       mpFuncData;         // Pointer to data in collection
      47             :     sal_uLong       nHandle;            // is casted from double to sal_uLong
      48             :     ParamType       meType;             // result of type PTR_DOUBLE or PTR_STRING
      49             :     bool            bValid;             // is value valid?
      50             : 
      51             : public:
      52             :     // cTor only if ScAddInAsync::Get fails.
      53             :     // nIndex: Index from FunctionCollection
      54             :     ScAddInAsync(sal_uLong nHandle, FuncData* pFuncData, ScDocument* pDoc);
      55             :                     // default-cTor only for that single, global aSeekObj!
      56             :                     ScAddInAsync();
      57             :     virtual         ~ScAddInAsync();
      58             :     static ScAddInAsync*    Get( sal_uLong nHandle );
      59             :     static void     CallBack( sal_uLong nHandle, void* pData );
      60             :     static void     RemoveDocument( ScDocument* pDocument );
      61           0 :     bool            IsValid() const         { return bValid; }
      62           0 :     ParamType       GetType() const         { return meType; }
      63           0 :     double          GetValue() const        { return nVal; }
      64           0 :     const String&   GetString() const       { return *pStr; }
      65           0 :     bool            HasDocument( ScDocument* pDoc ) const
      66           0 :                         { return pDocs->find( pDoc ) != pDocs->end(); }
      67           0 :     void            AddDocument( ScDocument* pDoc ) { pDocs->insert( pDoc ); }
      68             : 
      69             :     // Comparators for PtrArrSort
      70           0 :     bool operator< ( const ScAddInAsync& r ) const { return nHandle <  r.nHandle; }
      71             :     bool operator==( const ScAddInAsync& r ) const { return nHandle == r.nHandle; }
      72             : };
      73             : 
      74             : struct CompareScAddInAsync
      75             : {
      76           0 :   bool operator()( ScAddInAsync* const& lhs, ScAddInAsync* const& rhs ) const { return (*lhs)<(*rhs); }
      77             : };
      78          10 : class ScAddInAsyncs : public std::set<ScAddInAsync*, CompareScAddInAsync> {};
      79             : 
      80             : extern ScAddInAsyncs theAddInAsyncTbl;  // in adiasync.cxx
      81             : 
      82             : #endif
      83             : 
      84             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10