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

Generated by: LCOV version 1.10