LCOV - code coverage report
Current view: top level - include/basic - sbxcore.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 23 0.0 %
Date: 2014-04-14 Functions: 0 14 0.0 %
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             : #include <tools/debug.hxx>
      26             : 
      27             : #include <basic/sbxdef.hxx>
      28             : #include <basic/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 SAL_OVERRIDE { return nCre;   }    \
      40             :     virtual sal_uInt16 GetVersion() const SAL_OVERRIDE { return nVer;   }    \
      41             :     virtual sal_uInt16 GetSbxId() const SAL_OVERRIDE   { return nSbxId; }
      42             : 
      43             : // This version of the macro defines Load/StorePrivateData()-methods
      44             : #define SBX_DECL_PERSIST( nCre, nSbxId, nVer )              \
      45             :     virtual bool LoadPrivateData( SvStream&, sal_uInt16 );      \
      46             :     virtual bool StorePrivateData( SvStream& ) const;       \
      47             :     virtual sal_uInt32 GetCreator() const { return nCre;   }    \
      48             :     virtual sal_uInt16 GetVersion() const { return nVer;   }    \
      49             :     virtual sal_uInt16 GetSbxId() const   { return nSbxId; }
      50             : 
      51             : class SbxBase;
      52             : class SbxFactory;
      53             : class SbxObject;
      54             : 
      55             : class BASIC_DLLPUBLIC SbxBase : virtual public SvRefBase
      56             : {
      57             :     virtual bool LoadData( SvStream&, sal_uInt16 );
      58             :     virtual 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 bool         IsSet( sal_uInt16 n ) const;
      74             :     inline bool         IsReset( sal_uInt16 n ) const;
      75             :     inline bool         CanRead() const;
      76             :     inline bool         CanWrite() const;
      77             :     inline bool         IsModified() const;
      78             :     inline bool         IsConst() const;
      79             :     inline bool         IsHidden() const;
      80             :     inline bool         IsVisible() const;
      81             : 
      82             :     virtual bool        IsFixed() const;
      83             :     virtual void        SetModified( 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             :     bool            Store( SvStream& );
      93             :     virtual bool    LoadCompleted();
      94             :     virtual bool    StoreCompleted();
      95             : 
      96             :     static SbxError GetError();
      97             :     static void SetError( SbxError );
      98             :     static 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             : typedef tools::SvRef<SbxBase> SbxBaseRef;
     110             : 
     111           0 : inline void SbxBase::SetFlags( sal_uInt16 n )
     112           0 : { nFlags = n; }
     113             : 
     114           0 : inline sal_uInt16 SbxBase::GetFlags() const
     115           0 : { return nFlags; }
     116             : 
     117           0 : inline void SbxBase::SetFlag( sal_uInt16 n )
     118           0 : { nFlags |= n; }
     119             : 
     120           0 : inline void SbxBase::ResetFlag( sal_uInt16 n )
     121           0 : { nFlags &= ~n; }
     122             : 
     123           0 : inline bool SbxBase::IsSet( sal_uInt16 n ) const
     124           0 : { return ( nFlags & n ) != 0; }
     125             : 
     126           0 : inline bool SbxBase::IsReset( sal_uInt16 n ) const
     127           0 : { return ( nFlags & n ) == 0; }
     128             : 
     129           0 : inline bool SbxBase::CanRead() const
     130           0 : { return IsSet( SBX_READ ); }
     131             : 
     132           0 : inline bool SbxBase::CanWrite() const
     133           0 : { return IsSet( SBX_WRITE ); }
     134             : 
     135           0 : inline bool SbxBase::IsModified() const
     136           0 : { return IsSet( SBX_MODIFIED ); }
     137             : 
     138             : inline bool SbxBase::IsConst() const
     139             : { return IsSet( SBX_CONST ); }
     140             : 
     141           0 : inline bool SbxBase::IsHidden() const
     142           0 : { return IsSet( SBX_HIDDEN ); }
     143             : 
     144           0 : inline bool SbxBase::IsVisible() const
     145           0 : { return IsReset( SBX_INVISIBLE ); }
     146             : 
     147             : #endif
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10