LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/basic - sbx.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 15 22 68.2 %
Date: 2013-07-09 Functions: 36 53 67.9 %
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 _SBXCLASS_HXX
      21             : #define _SBXCLASS_HXX
      22             : 
      23             : #include "tools/ref.hxx"
      24             : #include "svl/smplhint.hxx"
      25             : #include "svl/lstner.hxx"
      26             : 
      27             : #include <basic/sbxdef.hxx>
      28             : #include <basic/sbxform.hxx>
      29             : #include <basic/sbxobj.hxx>
      30             : #include <basic/sbxprop.hxx>
      31             : #include <basic/sbxmeth.hxx>
      32             : #include "basicdllapi.h"
      33             : 
      34             : #include <boost/ptr_container/ptr_vector.hpp>
      35             : 
      36             : class SvStream;
      37             : class SbxBase;
      38             : class SbxVariable;
      39             : class SbxProperty;
      40             : class SbxMethod;
      41             : class SbxObject;
      42             : class SbxArray;
      43             : class SbxDimArray;
      44             : class SbxFactory;
      45             : 
      46             : class SfxBroadcaster;
      47             : 
      48             : // Parameter information
      49             : struct SbxParamInfo
      50             : {
      51             :     const OUString aName;          // Name of the parameter
      52             :     SbxBaseRef     aTypeRef;       // Object, if object type
      53             :     SbxDataType    eType;          // Data type
      54             :     sal_uInt16     nFlags;         // Flag-Bits
      55             :     sal_uInt32     nUserData;      // IDs etc.
      56         464 :     SbxParamInfo( const OUString& s, SbxDataType t, sal_uInt16 n, SbxBase* b = NULL )
      57         464 :         : aName( s ), aTypeRef( b ), eType( t ), nFlags( n ), nUserData( 0 ) {}
      58         259 :     ~SbxParamInfo() {}
      59             : };
      60             : 
      61             : typedef boost::ptr_vector<SbxParamInfo> SbxParams;
      62             : 
      63             : class BASIC_DLLPUBLIC SbxInfo : public SvRefBase
      64             : {
      65             :     friend class SbxVariable;
      66             :     friend class SbMethod;
      67             : 
      68             :     OUString        aComment;
      69             :     OUString        aHelpFile;
      70             :     sal_uInt32      nHelpId;
      71             :     SbxParams       aParams;
      72             : 
      73             : protected:
      74             :     sal_Bool LoadData( SvStream&, sal_uInt16 );
      75             :     sal_Bool StoreData( SvStream& ) const;
      76             :     virtual ~SbxInfo();
      77             : public:
      78             :     SbxInfo();
      79             :     SbxInfo( const OUString&, sal_uInt32 );
      80             : 
      81             :     void                AddParam( const OUString&, SbxDataType, sal_uInt16=SBX_READ );
      82             :     const SbxParamInfo* GetParam( sal_uInt16 n ) const; // index starts with 1!
      83           0 :     const OUString&     GetComment() const              { return aComment; }
      84           0 :     const OUString&     GetHelpFile() const             { return aHelpFile; }
      85           0 :     sal_uInt32          GetHelpId() const               { return nHelpId;   }
      86             : 
      87         386 :     void                SetComment( const OUString& r )   { aComment = r; }
      88             :     void                SetHelpFile( const OUString& r )  { aHelpFile = r; }
      89             :     void                SetHelpId( sal_uInt32 nId )         { nHelpId = nId; }
      90             : };
      91             : 
      92       31240 : class BASIC_DLLPUBLIC SbxHint : public SfxSimpleHint
      93             : {
      94             :     SbxVariable* pVar;
      95             : public:
      96             :     TYPEINFO();
      97       31240 :     SbxHint( sal_uIntPtr n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {}
      98       31622 :     SbxVariable* GetVar() const { return pVar; }
      99             : };
     100             : 
     101             : // SbxAlias is an alias for a var or object
     102             : class BASIC_DLLPUBLIC SbxAlias : public SbxVariable, public SfxListener
     103             : {
     104             :     SbxVariableRef xAlias;
     105             :     virtual ~SbxAlias();
     106             :     virtual void Broadcast( sal_uIntPtr );
     107             :     virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
     108             :                              const SfxHint& rHint, const TypeId& rHintType );
     109             : public:
     110             :     SbxAlias( const SbxAlias& );
     111             :     SbxAlias& operator=( const SbxAlias& );
     112             : };
     113             : 
     114             : // SbxArray is an unidimensional, dynamic Array
     115             : // The variables convert from SbxVariablen. Put()/Insert() into the
     116             : // declared datatype, if they are not SbxVARIANT.
     117             : 
     118             : class SbxVarRefs;
     119             : class SbxVariableRef;
     120             : 
     121             : class BASIC_DLLPUBLIC SbxArray : public SbxBase
     122             : {
     123             : // #100883 Method to set method directly to parameter array
     124             :     friend class SbMethod;
     125             :     friend class SbClassModuleObject;
     126             :     friend SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
     127             :     BASIC_DLLPRIVATE void PutDirect( SbxVariable* pVar, sal_uInt32 nIdx );
     128             : 
     129             :     SbxVarRefs*   pData;          // The variables
     130             : 
     131             : protected:
     132             :     SbxDataType eType;            // Data type of the array
     133             :     virtual ~SbxArray();
     134             :     virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
     135             :     virtual sal_Bool StoreData( SvStream& ) const;
     136             : 
     137             : public:
     138           0 :     SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_ARRAY,1);
     139             :     TYPEINFO();
     140             :     SbxArray( SbxDataType=SbxVARIANT );
     141             :     SbxArray( const SbxArray& );
     142             :     SbxArray& operator=( const SbxArray& );
     143             :     virtual void Clear();
     144             :     sal_uInt16           Count() const;
     145             :     virtual SbxDataType  GetType() const;
     146             :     virtual SbxClassType GetClass() const;
     147             :     SbxVariableRef&      GetRef( sal_uInt16 );
     148             :     SbxVariable*         Get( sal_uInt16 );
     149             :     void                 Put( SbxVariable*, sal_uInt16 );
     150             :     void                 Insert( SbxVariable*, sal_uInt16 );
     151             :     void                 Remove( sal_uInt16 );
     152             :     void                 Remove( SbxVariable* );
     153             :     void                 Merge( SbxArray* );
     154             :     const OUString&      GetAlias( sal_uInt16 );
     155             :     void                 PutAlias( const OUString&, sal_uInt16 );
     156             :     SbxVariable*         FindUserData( sal_uInt32 nUserData );
     157             :     virtual SbxVariable* Find( const OUString&, SbxClassType );
     158             : 
     159             :     // Additional methods for 32-bit indices
     160             :     sal_uInt32           Count32() const;
     161             :     SbxVariableRef&      GetRef32( sal_uInt32 );
     162             :     SbxVariable*         Get32( sal_uInt32 );
     163             :     void                 Put32( SbxVariable*, sal_uInt32 );
     164             :     void                 Insert32( SbxVariable*, sal_uInt32 );
     165             :     void                 Remove32( sal_uInt32 );
     166             : };
     167             : 
     168             : // SbxDimArray is an array that can dimensioned using BASIC conventions.
     169             : struct SbxDim;
     170             : 
     171             : class BASIC_DLLPUBLIC SbxDimArray : public SbxArray
     172             : {
     173             :     SbxDim* pFirst, *pLast;               // Links to Dimension table
     174             :     short   nDim;                         // Number of dimensions
     175             :     BASIC_DLLPRIVATE void AddDimImpl32( sal_Int32, sal_Int32, sal_Bool bAllowSize0 );
     176             :     bool mbHasFixedSize;
     177             : protected:
     178             :     sal_uInt16  Offset( const short* );
     179             :     sal_uInt32  Offset32( const sal_Int32* );
     180             :     sal_uInt32  Offset32( SbxArray* );
     181             :     virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
     182             :     virtual sal_Bool StoreData( SvStream& ) const;
     183             :     virtual ~SbxDimArray();
     184             : public:
     185           0 :     SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_DIMARRAY,1);
     186             :     TYPEINFO();
     187             :     SbxDimArray( SbxDataType=SbxVARIANT );
     188             :     SbxDimArray( const SbxDimArray& );
     189             :     SbxDimArray& operator=( const SbxDimArray& );
     190             :     virtual void Clear();
     191             :     using SbxArray::GetRef;
     192             :     using SbxArray::Get;
     193             :     SbxVariable* Get( const short* );
     194             :     using SbxArray::Put;
     195             :     void Put( SbxVariable*, const short* );
     196             :     SbxVariable* Get( SbxArray* );
     197             : 
     198             :     short  GetDims() const;
     199             :     void   AddDim( short, short );
     200             :     void   unoAddDim( short, short );
     201             :     sal_Bool   GetDim( short, short&, short& ) const;
     202             : 
     203             :     using SbxArray::GetRef32;
     204             :     using SbxArray::Get32;
     205             :     SbxVariable* Get32( const sal_Int32* );
     206             :     using SbxArray::Put32;
     207             :     void Put32( SbxVariable*, const sal_Int32* );
     208             :     void   AddDim32( sal_Int32, sal_Int32 );
     209             :     void   unoAddDim32( sal_Int32, sal_Int32 );
     210             :     sal_Bool   GetDim32( sal_Int32, sal_Int32&, sal_Int32& ) const;
     211           4 :     bool hasFixedSize() { return mbHasFixedSize; };
     212          17 :     void setHasFixedSize( bool bHasFixedSize ) {mbHasFixedSize = bHasFixedSize; };
     213             : };
     214             : 
     215             : class BASIC_DLLPUBLIC SbxCollection : public SbxObject
     216             : {
     217             :     BASIC_DLLPRIVATE void Initialize();
     218             : protected:
     219             :     virtual ~SbxCollection();
     220             :     virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
     221             :     virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
     222             :                              const SfxHint& rHint, const TypeId& rHintType );
     223             :     // Overridable methods (why not pure virtual?):
     224             :     virtual void CollAdd( SbxArray* pPar );
     225             :     virtual void CollItem( SbxArray* pPar );
     226             :     virtual void CollRemove( SbxArray* pPar );
     227             : 
     228             : public:
     229           0 :     SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_COLLECTION,1);
     230             :     TYPEINFO();
     231             :     SbxCollection( const OUString& rClassname );
     232             :     SbxCollection( const SbxCollection& );
     233             :     SbxCollection& operator=( const SbxCollection& );
     234             :     virtual SbxVariable* FindUserData( sal_uInt32 nUserData );
     235             :     virtual SbxVariable* Find( const OUString&, SbxClassType );
     236             :     virtual void Clear();
     237             : };
     238             : 
     239             : class BASIC_DLLPUBLIC SbxStdCollection : public SbxCollection
     240             : {
     241             : protected:
     242             :     OUString aElemClass;
     243             :     sal_Bool bAddRemoveOk;
     244             :     virtual ~SbxStdCollection();
     245             :     virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
     246             :     virtual sal_Bool StoreData( SvStream& ) const;
     247             :     virtual void CollAdd( SbxArray* pPar );
     248             :     virtual void CollRemove( SbxArray* pPar );
     249             : public:
     250           0 :     SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_FIXCOLLECTION,1);
     251             :     TYPEINFO();
     252             :     SbxStdCollection( const OUString& rClassname, const OUString& rElemClass, sal_Bool=sal_True );
     253             :     SbxStdCollection( const SbxStdCollection& );
     254             :     SbxStdCollection& operator=( const SbxStdCollection& );
     255             :     virtual void Insert( SbxVariable* );
     256             :     const OUString& GetElementClass() const { return aElemClass; }
     257             : };
     258             : 
     259       39871 : SV_IMPL_REF(SbxBase)
     260             : 
     261      535701 : SV_IMPL_REF(SbxVariable)
     262             : 
     263             : #ifndef SBX_ARRAY_DECL_DEFINED
     264             : #define SBX_ARRAY_DECL_DEFINED
     265             : SV_DECL_REF(SbxArray)
     266             : #endif
     267      386596 : SV_IMPL_REF(SbxArray)
     268             : 
     269             : #ifndef SBX_INFO_DECL_DEFINED
     270             : #define SBX_INFO_DECL_DEFINED
     271             : SV_DECL_REF(SbxInfo)
     272             : #endif
     273       58038 : SV_IMPL_REF(SbxInfo)
     274             : 
     275          77 : SV_DECL_REF(SbxDimArray)
     276         102 : SV_IMPL_REF(SbxDimArray)
     277             : 
     278             : #endif
     279             : 
     280             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10