LCOV - code coverage report
Current view: top level - include/basic - sbx.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 16 0.0 %
Date: 2014-04-14 Functions: 0 24 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_SBX_HXX
      21             : #define INCLUDED_BASIC_SBX_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 <basic/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           0 :     SbxParamInfo( const OUString& s, SbxDataType t, sal_uInt16 n, SbxBase* b = NULL )
      57           0 :         : aName( s ), aTypeRef( b ), eType( t ), nFlags( n ), nUserData( 0 ) {}
      58           0 :     ~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             :     bool LoadData( SvStream&, sal_uInt16 );
      75             :     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           0 :     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           0 : class BASIC_DLLPUBLIC SbxHint : public SfxSimpleHint
      93             : {
      94             :     SbxVariable* pVar;
      95             : public:
      96             :     TYPEINFO_OVERRIDE();
      97           0 :     SbxHint( sal_uIntPtr n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {}
      98           0 :     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 ) SAL_OVERRIDE;
     107             :     virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
     108             :                              const SfxHint& rHint, const TypeId& rHintType ) SAL_OVERRIDE;
     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             : 
     120             : class BASIC_DLLPUBLIC SbxArray : public SbxBase
     121             : {
     122             : // #100883 Method to set method directly to parameter array
     123             :     friend class SbMethod;
     124             :     friend class SbClassModuleObject;
     125             :     friend SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
     126             :     BASIC_DLLPRIVATE void PutDirect( SbxVariable* pVar, sal_uInt32 nIdx );
     127             : 
     128             :     SbxVarRefs*   pData;          // The variables
     129             : 
     130             : protected:
     131             :     SbxDataType eType;            // Data type of the array
     132             :     virtual ~SbxArray();
     133             :     virtual bool LoadData( SvStream&, sal_uInt16 ) SAL_OVERRIDE;
     134             :     virtual bool StoreData( SvStream& ) const SAL_OVERRIDE;
     135             : 
     136             : public:
     137           0 :     SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_ARRAY,1);
     138             :     TYPEINFO_OVERRIDE();
     139             :     SbxArray( SbxDataType=SbxVARIANT );
     140             :     SbxArray( const SbxArray& );
     141             :     SbxArray& operator=( const SbxArray& );
     142             :     virtual void Clear() SAL_OVERRIDE;
     143             :     sal_uInt16           Count() const;
     144             :     virtual SbxDataType  GetType() const SAL_OVERRIDE;
     145             :     virtual SbxClassType GetClass() const SAL_OVERRIDE;
     146             :     SbxVariableRef&      GetRef( sal_uInt16 );
     147             :     SbxVariable*         Get( sal_uInt16 );
     148             :     void                 Put( SbxVariable*, sal_uInt16 );
     149             :     void                 Insert( SbxVariable*, sal_uInt16 );
     150             :     void                 Remove( sal_uInt16 );
     151             :     void                 Remove( SbxVariable* );
     152             :     void                 Merge( SbxArray* );
     153             :     const OUString&      GetAlias( sal_uInt16 );
     154             :     void                 PutAlias( const OUString&, sal_uInt16 );
     155             :     SbxVariable*         FindUserData( sal_uInt32 nUserData );
     156             :     virtual SbxVariable* Find( const OUString&, SbxClassType );
     157             : 
     158             :     // Additional methods for 32-bit indices
     159             :     sal_uInt32           Count32() const;
     160             :     SbxVariableRef&      GetRef32( sal_uInt32 );
     161             :     SbxVariable*         Get32( sal_uInt32 );
     162             :     void                 Put32( SbxVariable*, sal_uInt32 );
     163             :     void                 Insert32( SbxVariable*, sal_uInt32 );
     164             :     void                 Remove32( sal_uInt32 );
     165             : };
     166             : 
     167             : // SbxDimArray is an array that can dimensioned using BASIC conventions.
     168             : struct SbxDim;
     169             : 
     170             : class BASIC_DLLPUBLIC SbxDimArray : public SbxArray
     171             : {
     172             :     SbxDim* pFirst, *pLast;               // Links to Dimension table
     173             :     short   nDim;                         // Number of dimensions
     174             :     BASIC_DLLPRIVATE void AddDimImpl32( sal_Int32, sal_Int32, bool bAllowSize0 );
     175             :     bool mbHasFixedSize;
     176             : protected:
     177             :     sal_uInt16  Offset( const short* );
     178             :     sal_uInt32  Offset32( const sal_Int32* );
     179             :     sal_uInt32  Offset32( SbxArray* );
     180             :     virtual bool LoadData( SvStream&, sal_uInt16 ) SAL_OVERRIDE;
     181             :     virtual bool StoreData( SvStream& ) const SAL_OVERRIDE;
     182             :     virtual ~SbxDimArray();
     183             : public:
     184           0 :     SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_DIMARRAY,1);
     185             :     TYPEINFO_OVERRIDE();
     186             :     SbxDimArray( SbxDataType=SbxVARIANT );
     187             :     SbxDimArray( const SbxDimArray& );
     188             :     SbxDimArray& operator=( const SbxDimArray& );
     189             :     virtual void Clear() SAL_OVERRIDE;
     190             :     using SbxArray::GetRef;
     191             :     using SbxArray::Get;
     192             :     SbxVariable* Get( const short* );
     193             :     using SbxArray::Put;
     194             :     void Put( SbxVariable*, const short* );
     195             :     SbxVariable* Get( SbxArray* );
     196             : 
     197             :     short  GetDims() const;
     198             :     void   AddDim( short, short );
     199             :     void   unoAddDim( short, short );
     200             :     bool   GetDim( short, short&, short& ) const;
     201             : 
     202             :     using SbxArray::GetRef32;
     203             :     using SbxArray::Get32;
     204             :     SbxVariable* Get32( const sal_Int32* );
     205             :     using SbxArray::Put32;
     206             :     void Put32( SbxVariable*, const sal_Int32* );
     207             :     void   AddDim32( sal_Int32, sal_Int32 );
     208             :     void   unoAddDim32( sal_Int32, sal_Int32 );
     209             :     bool   GetDim32( sal_Int32, sal_Int32&, sal_Int32& ) const;
     210           0 :     bool hasFixedSize() { return mbHasFixedSize; };
     211           0 :     void setHasFixedSize( bool bHasFixedSize ) {mbHasFixedSize = bHasFixedSize; };
     212             : };
     213             : 
     214             : class BASIC_DLLPUBLIC SbxCollection : public SbxObject
     215             : {
     216             :     BASIC_DLLPRIVATE void Initialize();
     217             : protected:
     218             :     virtual ~SbxCollection();
     219             :     virtual bool LoadData( SvStream&, sal_uInt16 ) SAL_OVERRIDE;
     220             :     virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
     221             :                              const SfxHint& rHint, const TypeId& rHintType ) SAL_OVERRIDE;
     222             :     // Overridable methods (why not pure virtual?):
     223             :     virtual void CollAdd( SbxArray* pPar );
     224             :     virtual void CollItem( SbxArray* pPar );
     225             :     virtual void CollRemove( SbxArray* pPar );
     226             : 
     227             : public:
     228           0 :     SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_COLLECTION,1);
     229             :     TYPEINFO_OVERRIDE();
     230             :     SbxCollection( const OUString& rClassname );
     231             :     SbxCollection( const SbxCollection& );
     232             :     SbxCollection& operator=( const SbxCollection& );
     233             :     virtual SbxVariable* FindUserData( sal_uInt32 nUserData ) SAL_OVERRIDE;
     234             :     virtual SbxVariable* Find( const OUString&, SbxClassType ) SAL_OVERRIDE;
     235             :     virtual void Clear() SAL_OVERRIDE;
     236             : };
     237             : 
     238             : class BASIC_DLLPUBLIC SbxStdCollection : public SbxCollection
     239             : {
     240             : protected:
     241             :     OUString aElemClass;
     242             :     bool bAddRemoveOk;
     243             :     virtual ~SbxStdCollection();
     244             :     virtual bool LoadData( SvStream&, sal_uInt16 ) SAL_OVERRIDE;
     245             :     virtual bool StoreData( SvStream& ) const SAL_OVERRIDE;
     246             :     virtual void CollAdd( SbxArray* pPar ) SAL_OVERRIDE;
     247             :     virtual void CollRemove( SbxArray* pPar ) SAL_OVERRIDE;
     248             : public:
     249           0 :     SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_FIXCOLLECTION,1);
     250             :     TYPEINFO_OVERRIDE();
     251             :     SbxStdCollection( const OUString& rClassname, const OUString& rElemClass, bool=true );
     252             :     SbxStdCollection( const SbxStdCollection& );
     253             :     SbxStdCollection& operator=( const SbxStdCollection& );
     254             :     virtual void Insert( SbxVariable* ) SAL_OVERRIDE;
     255             :     const OUString& GetElementClass() const { return aElemClass; }
     256             : };
     257             : 
     258             : #ifndef SBX_ARRAY_DECL_DEFINED
     259             : #define SBX_ARRAY_DECL_DEFINED
     260             : typedef tools::SvRef<SbxArray> SbxArrayRef;
     261             : #endif
     262             : 
     263             : #ifndef SBX_INFO_DECL_DEFINED
     264             : #define SBX_INFO_DECL_DEFINED
     265             : typedef tools::SvRef<SbxInfo> SbxInfoRef;
     266             : #endif
     267             : 
     268             : typedef tools::SvRef<SbxDimArray> SbxDimArrayRef;
     269             : 
     270             : #endif
     271             : 
     272             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10