LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/basic - sbxcore.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 23 24 95.8 %
Date: 2012-08-25 Functions: 15 18 83.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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                 :            : class String;
      32                 :            : namespace rtl { class OUString; }
      33                 :            : 
      34                 :            : // The following Macro defines four (five) necessary methods within a
      35                 :            : // SBX object. LoadPrivateData() and StorePrivateData() must be implemented.
      36                 :            : // They are necessary for loading/storing the data of derived classes.
      37                 :            : // Load() and Store() must not be overridden.
      38                 :            : 
      39                 :            : // This version of the Macros does not define Load/StorePrivateData()-methods
      40                 :            : #define SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer )       \
      41                 :            :     virtual sal_uInt32 GetCreator() const { return nCre;   }    \
      42                 :            :     virtual sal_uInt16 GetVersion() const { return nVer;   }    \
      43                 :            :     virtual sal_uInt16 GetSbxId() const   { return nSbxId; }
      44                 :            : 
      45                 :            : // This version of the macro defines Load/StorePrivateData()-methods
      46                 :            : #define SBX_DECL_PERSIST( nCre, nSbxId, nVer )              \
      47                 :            :     virtual sal_Bool LoadPrivateData( SvStream&, sal_uInt16 );      \
      48                 :            :     virtual sal_Bool StorePrivateData( SvStream& ) const;       \
      49                 :            :     SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer )
      50                 :            : 
      51                 :            : class SbxBase;
      52                 :            : class SbxFactory;
      53                 :            : class SbxObject;
      54                 :            : 
      55                 :            : DBG_NAMEEX_VISIBILITY(SbxBase, BASIC_DLLPUBLIC)
      56                 :            : 
      57                 :            : class BASIC_DLLPUBLIC SbxBase : virtual public SvRefBase
      58                 :            : {
      59                 :            :     virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
      60                 :            :     virtual sal_Bool StoreData( SvStream& ) const;
      61                 :            : protected:
      62                 :            :     sal_uInt16 nFlags;          // Flag-Bits
      63                 :            : 
      64                 :            :     SbxBase();
      65                 :            :     SbxBase( const SbxBase& );
      66                 :            :     SbxBase& operator=( const SbxBase& );
      67                 :            :     virtual ~SbxBase();
      68                 :          0 :     SBX_DECL_PERSIST(0,0,0);
      69                 :            : public:
      70                 :            :     TYPEINFO();
      71                 :            :     inline void     SetFlags( sal_uInt16 n );
      72                 :            :     inline sal_uInt16   GetFlags() const;
      73                 :            :     inline void     SetFlag( sal_uInt16 n );
      74                 :            :     inline void     ResetFlag( sal_uInt16 n );
      75                 :            :     inline sal_Bool     IsSet( sal_uInt16 n ) const;
      76                 :            :     inline sal_Bool     IsReset( sal_uInt16 n ) const;
      77                 :            :     inline sal_Bool     CanRead() const;
      78                 :            :     inline sal_Bool     CanWrite() const;
      79                 :            :     inline sal_Bool     IsModified() const;
      80                 :            :     inline sal_Bool     IsConst() const;
      81                 :            :     inline sal_Bool     IsHidden() const;
      82                 :            :     inline sal_Bool     IsVisible() const;
      83                 :            : 
      84                 :            :     virtual sal_Bool IsFixed() const;
      85                 :            :     virtual void SetModified( sal_Bool );
      86                 :            : 
      87                 :            :     virtual SbxDataType  GetType()  const;
      88                 :            :     virtual SbxClassType GetClass() const;
      89                 :            : 
      90                 :            :     virtual void Clear();
      91                 :            : 
      92                 :            :     static SbxBase* Load( SvStream& );
      93                 :            :     static void Skip( SvStream& );
      94                 :            :     sal_Bool Store( SvStream& );
      95                 :            :     virtual sal_Bool LoadCompleted();
      96                 :            :     virtual sal_Bool StoreCompleted();
      97                 :            : 
      98                 :            :     static SbxError GetError();
      99                 :            :     static void SetError( SbxError );
     100                 :            :     static sal_Bool IsError();
     101                 :            :     static void ResetError();
     102                 :            : 
     103                 :            :     // Set the factory for Load/Store/Create
     104                 :            :     static void AddFactory( SbxFactory* );
     105                 :            :     static void RemoveFactory( SbxFactory* );
     106                 :            : 
     107                 :            :     static SbxBase* Create( sal_uInt16, sal_uInt32=SBXCR_SBX );
     108                 :            :     static SbxObject* CreateObject( const rtl::OUString& );
     109                 :            : };
     110                 :            : 
     111                 :            : #ifndef SBX_BASE_DECL_DEFINED
     112                 :            : #define SBX_BASE_DECL_DEFINED
     113                 :      44203 : SV_DECL_REF(SbxBase)
     114                 :            : #endif
     115                 :            : 
     116                 :      69792 : inline void SbxBase::SetFlags( sal_uInt16 n )
     117                 :            : { //DBG_CHKTHIS( SbxBase, 0 );
     118                 :      69792 :  nFlags = n; }
     119                 :            : 
     120                 :     157880 : inline sal_uInt16 SbxBase::GetFlags() const
     121                 :     157880 : { DBG_CHKTHIS( SbxBase, 0 ); return nFlags; }
     122                 :            : 
     123                 :     446480 : inline void SbxBase::SetFlag( sal_uInt16 n )
     124                 :            : { //DBG_CHKTHIS( SbxBase, 0 );
     125                 :     446480 :  nFlags |= n; }
     126                 :            : 
     127                 :     169116 : inline void SbxBase::ResetFlag( sal_uInt16 n )
     128                 :            : { //DBG_CHKTHIS( SbxBase, 0 );
     129                 :     169116 :  nFlags &= ~n; }
     130                 :            : 
     131                 :     930105 : inline sal_Bool SbxBase::IsSet( sal_uInt16 n ) const
     132                 :     930105 : { DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) != 0 ); }
     133                 :            : 
     134                 :    1419403 : inline sal_Bool SbxBase::IsReset( sal_uInt16 n ) const
     135                 :    1419403 : { DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) == 0 ); }
     136                 :            : 
     137                 :     181408 : inline sal_Bool SbxBase::CanRead() const
     138                 :     181408 : { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_READ ); }
     139                 :            : 
     140                 :     125440 : inline sal_Bool SbxBase::CanWrite() const
     141                 :     125440 : { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_WRITE ); }
     142                 :            : 
     143                 :       4654 : inline sal_Bool SbxBase::IsModified() const
     144                 :       4654 : { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_MODIFIED ); }
     145                 :            : 
     146                 :            : inline sal_Bool SbxBase::IsConst() const
     147                 :            : { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_CONST ); }
     148                 :            : 
     149                 :         16 : inline sal_Bool SbxBase::IsHidden() const
     150                 :         16 : { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_HIDDEN ); }
     151                 :            : 
     152                 :    1419403 : inline sal_Bool SbxBase::IsVisible() const
     153                 :    1419403 : { DBG_CHKTHIS( SbxBase, 0 ); return IsReset( SBX_INVISIBLE ); }
     154                 :            : 
     155                 :            : #endif
     156                 :            : 
     157                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10