LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/basic - sbxcore.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 23 24 95.8 %
Date: 2013-07-09 Functions: 15 18 83.3 %
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 _SBXCORE_HXX
      21             : #define _SBXCORE_HXX
      22             : 
      23             : #include <tools/rtti.hxx>
      24             : #include <tools/ref.hxx>
      25             : #include <tools/debug.hxx>
      26             : 
      27             : #include <basic/sbxdef.hxx>
      28             : #include "basicdllapi.h"
      29             : 
      30             : class SvStream;
      31             : 
      32             : // The following Macro defines four (five) necessary methods within a
      33             : // SBX object. LoadPrivateData() and StorePrivateData() must be implemented.
      34             : // They are necessary for loading/storing the data of derived classes.
      35             : // Load() and Store() must not be overridden.
      36             : 
      37             : // This version of the Macros does not define Load/StorePrivateData()-methods
      38             : #define SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer )       \
      39             :     virtual sal_uInt32 GetCreator() const { return nCre;   }    \
      40             :     virtual sal_uInt16 GetVersion() const { return nVer;   }    \
      41             :     virtual sal_uInt16 GetSbxId() const   { return nSbxId; }
      42             : 
      43             : // This version of the macro defines Load/StorePrivateData()-methods
      44             : #define SBX_DECL_PERSIST( nCre, nSbxId, nVer )              \
      45             :     virtual sal_Bool LoadPrivateData( SvStream&, sal_uInt16 );      \
      46             :     virtual sal_Bool StorePrivateData( SvStream& ) const;       \
      47             :     SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer )
      48             : 
      49             : class SbxBase;
      50             : class SbxFactory;
      51             : class SbxObject;
      52             : 
      53             : DBG_NAMEEX_VISIBILITY(SbxBase, BASIC_DLLPUBLIC)
      54             : 
      55             : class BASIC_DLLPUBLIC SbxBase : virtual public SvRefBase
      56             : {
      57             :     virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
      58             :     virtual sal_Bool StoreData( SvStream& ) const;
      59             : protected:
      60             :     sal_uInt16 nFlags;          // Flag-Bits
      61             : 
      62             :     SbxBase();
      63             :     SbxBase( const SbxBase& );
      64             :     SbxBase& operator=( const SbxBase& );
      65             :     virtual ~SbxBase();
      66           0 :     SBX_DECL_PERSIST(0,0,0);
      67             : public:
      68             :     TYPEINFO();
      69             :     inline void         SetFlags( sal_uInt16 n );
      70             :     inline sal_uInt16   GetFlags() const;
      71             :     inline void         SetFlag( sal_uInt16 n );
      72             :     inline void         ResetFlag( sal_uInt16 n );
      73             :     inline sal_Bool     IsSet( sal_uInt16 n ) const;
      74             :     inline sal_Bool     IsReset( sal_uInt16 n ) const;
      75             :     inline sal_Bool     CanRead() const;
      76             :     inline sal_Bool     CanWrite() const;
      77             :     inline sal_Bool     IsModified() const;
      78             :     inline sal_Bool     IsConst() const;
      79             :     inline sal_Bool     IsHidden() const;
      80             :     inline sal_Bool     IsVisible() const;
      81             : 
      82             :     virtual sal_Bool    IsFixed() const;
      83             :     virtual void        SetModified( sal_Bool );
      84             : 
      85             :     virtual SbxDataType GetType()  const;
      86             :     virtual SbxClassType GetClass() const;
      87             : 
      88             :     virtual void Clear();
      89             : 
      90             :     static SbxBase* Load( SvStream& );
      91             :     static void     Skip( SvStream& );
      92             :     sal_Bool        Store( SvStream& );
      93             :     virtual sal_Bool LoadCompleted();
      94             :     virtual sal_Bool StoreCompleted();
      95             : 
      96             :     static SbxError GetError();
      97             :     static void SetError( SbxError );
      98             :     static sal_Bool IsError();
      99             :     static void ResetError();
     100             : 
     101             :     // Set the factory for Load/Store/Create
     102             :     static void AddFactory( SbxFactory* );
     103             :     static void RemoveFactory( SbxFactory* );
     104             : 
     105             :     static SbxBase* Create( sal_uInt16, sal_uInt32=SBXCR_SBX );
     106             :     static SbxObject* CreateObject( const OUString& );
     107             : };
     108             : 
     109       63343 : SV_DECL_REF(SbxBase)
     110             : 
     111       69819 : inline void SbxBase::SetFlags( sal_uInt16 n )
     112             : { //DBG_CHKTHIS( SbxBase, 0 );
     113       69819 :  nFlags = n; }
     114             : 
     115      171673 : inline sal_uInt16 SbxBase::GetFlags() const
     116      171673 : { DBG_CHKTHIS( SbxBase, 0 ); return nFlags; }
     117             : 
     118      475467 : inline void SbxBase::SetFlag( sal_uInt16 n )
     119             : { //DBG_CHKTHIS( SbxBase, 0 );
     120      475467 :  nFlags |= n; }
     121             : 
     122      152266 : inline void SbxBase::ResetFlag( sal_uInt16 n )
     123             : { //DBG_CHKTHIS( SbxBase, 0 );
     124      152266 :  nFlags &= ~n; }
     125             : 
     126     1021539 : inline sal_Bool SbxBase::IsSet( sal_uInt16 n ) const
     127     1021539 : { DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) != 0 ); }
     128             : 
     129      847610 : inline sal_Bool SbxBase::IsReset( sal_uInt16 n ) const
     130      847610 : { DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) == 0 ); }
     131             : 
     132      215287 : inline sal_Bool SbxBase::CanRead() const
     133      215287 : { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_READ ); }
     134             : 
     135      188966 : inline sal_Bool SbxBase::CanWrite() const
     136      188966 : { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_WRITE ); }
     137             : 
     138        3953 : inline sal_Bool SbxBase::IsModified() const
     139        3953 : { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_MODIFIED ); }
     140             : 
     141             : inline sal_Bool SbxBase::IsConst() const
     142             : { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_CONST ); }
     143             : 
     144          76 : inline sal_Bool SbxBase::IsHidden() const
     145          76 : { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_HIDDEN ); }
     146             : 
     147      847610 : inline sal_Bool SbxBase::IsVisible() const
     148      847610 : { DBG_CHKTHIS( SbxBase, 0 ); return IsReset( SBX_INVISIBLE ); }
     149             : 
     150             : #endif
     151             : 
     152             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10