LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/basic - sbstar.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 8 62.5 %
Date: 2012-08-25 Functions: 12 19 63.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 12 58.3 %

           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 _SB_SBSTAR_HXX
      21                 :            : #define _SB_SBSTAR_HXX
      22                 :            : 
      23                 :            : #include <basic/sbx.hxx>
      24                 :            : #include <basic/sbxobj.hxx>
      25                 :            : #include <rtl/ustring.hxx>
      26                 :            : #include <osl/mutex.hxx>
      27                 :            : #include <tools/link.hxx>
      28                 :            : 
      29                 :            : #include <basic/sbdef.hxx>
      30                 :            : #include <basic/sberrors.hxx>
      31                 :            : #include <com/sun/star/script/ModuleInfo.hpp>
      32                 :            : #include <com/sun/star/frame/XModel.hpp>
      33                 :            : #include "basicdllapi.h"
      34                 :            : 
      35                 :            : class SbModule;                     // completed module
      36                 :            : class SbiInstance;                  // runtime instance
      37                 :            : class SbiRuntime;                   // currently running procedure
      38                 :            : class SbiImage;                     // compiled image
      39                 :            : class BasicLibInfo;                 // info block for basic manager
      40                 :            : class SbMethod;
      41                 :            : class BasicManager;
      42                 :            : class DocBasicItem;
      43                 :            : 
      44                 :            : class StarBASICImpl;
      45                 :            : 
      46                 :            : class BASIC_DLLPUBLIC StarBASIC : public SbxObject
      47                 :            : {
      48                 :            :     friend class SbiScanner;
      49                 :            :     friend class SbiExpression; // Access to RTL
      50                 :            :     friend class SbiInstance;
      51                 :            :     friend class SbiRuntime;
      52                 :            :     friend class DocBasicItem;
      53                 :            : 
      54                 :            :     StarBASICImpl*  mpStarBASICImpl;
      55                 :            : 
      56                 :            :     SbxArrayRef     pModules;               // List of all modules
      57                 :            :     SbxObjectRef    pRtl;               // Runtime Library
      58                 :            :     SbxArrayRef     xUnoListeners;          // Listener handled by CreateUnoListener
      59                 :            : 
      60                 :            :    // Handler-Support:
      61                 :            :     Link            aErrorHdl;              // Error handler
      62                 :            :     Link            aBreakHdl;              // Breakpoint handler
      63                 :            :     sal_Bool            bNoRtl;                 // if sal_True: do not search RTL
      64                 :            :     sal_Bool            bBreak;                 // if sal_True: Break, otherwise Step
      65                 :            :     sal_Bool            bDocBasic;
      66                 :            :     sal_Bool            bVBAEnabled;
      67                 :            :     BasicLibInfo*   pLibInfo;           // Info block for basic manager
      68                 :            :     sal_Bool            bQuit;
      69                 :            : 
      70                 :            :     SbxObjectRef pVBAGlobals;
      71                 :            :     BASIC_DLLPRIVATE SbxObject* getVBAGlobals( );
      72                 :            : 
      73                 :            :     BASIC_DLLPRIVATE void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic );
      74                 :            : 
      75                 :            : protected:
      76                 :            :     sal_Bool            CError( SbError, const ::rtl::OUString&, xub_StrLen, xub_StrLen, xub_StrLen );
      77                 :            : private:
      78                 :            :     BASIC_DLLPRIVATE sal_Bool           RTError( SbError, xub_StrLen, xub_StrLen, xub_StrLen );
      79                 :            :     BASIC_DLLPRIVATE sal_Bool           RTError( SbError, const String& rMsg, xub_StrLen, xub_StrLen, xub_StrLen );
      80                 :            :     BASIC_DLLPRIVATE sal_uInt16             BreakPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 );
      81                 :            :     BASIC_DLLPRIVATE sal_uInt16             StepPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 );
      82                 :            :     virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
      83                 :            :     virtual sal_Bool StoreData( SvStream& ) const;
      84                 :            : 
      85                 :            : protected:
      86                 :            : 
      87                 :            :     virtual sal_Bool    ErrorHdl();
      88                 :            :     virtual sal_uInt16  BreakHdl();
      89                 :            :     virtual ~StarBASIC();
      90                 :            : 
      91                 :            : public:
      92                 :            : 
      93                 :          0 :     SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASIC,1);
      94                 :            :     TYPEINFO();
      95                 :            : 
      96                 :            :     StarBASIC( StarBASIC* pParent = NULL, sal_Bool bIsDocBasic = sal_False );
      97                 :            : 
      98                 :            :     // #51727 SetModified overridden so that the Modfied-State is
      99                 :            :         // not delivered to Parent.
     100                 :            :     virtual void SetModified( sal_Bool );
     101                 :            : 
     102                 :            :     void* operator  new( size_t );
     103                 :            :     void operator   delete( void* );
     104                 :            : 
     105                 :            :     virtual void    Insert( SbxVariable* );
     106                 :            :     using SbxObject::Remove;
     107                 :            :     virtual void    Remove( SbxVariable* );
     108                 :            :     virtual void    Clear();
     109                 :            : 
     110                 :            :     BasicLibInfo*   GetLibInfo()                    { return pLibInfo;  }
     111                 :            :     void            SetLibInfo( BasicLibInfo* p )   { pLibInfo = p;     }
     112                 :            : 
     113                 :            :     // Compiler-Interface
     114                 :            :     SbModule*       MakeModule( const String& rName, const String& rSrc );
     115                 :            :     SbModule*       MakeModule32( const String& rName, const ::rtl::OUString& rSrc );
     116                 :            :     SbModule*       MakeModule32( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, const ::rtl::OUString& rSrc );
     117                 :            :     sal_Bool            Compile( SbModule* );
     118                 :            :     static void     Stop();
     119                 :            :     static void     Error( SbError );
     120                 :            :     static void     Error( SbError, const String& rMsg );
     121                 :            :     static void     FatalError( SbError );
     122                 :            :     static void     FatalError( SbError, const String& rMsg );
     123                 :            :     static sal_Bool     IsRunning();
     124                 :            :     static SbError  GetErrBasic();
     125                 :            :     // #66536 make additional message accessible by RTL function Error
     126                 :            :     static String   GetErrorMsg();
     127                 :            :     static xub_StrLen GetErl();
     128                 :            : 
     129                 :            :     virtual SbxVariable* Find( const rtl::OUString&, SbxClassType );
     130                 :            :     virtual sal_Bool Call( const String&, SbxArray* = NULL );
     131                 :            : 
     132                 :        169 :     SbxArray*       GetModules() { return pModules; }
     133                 :       1723 :     SbxObject*      GetRtl()     { return pRtl;     }
     134                 :            :     SbModule*       FindModule( const String& );
     135                 :            :     // Run init code of all modules (including the inserted Doc-Basics)
     136                 :            :     void            InitAllModules( StarBASIC* pBasicNotToInit = NULL );
     137                 :            :     void            DeInitAllModules( void );
     138                 :            :     void            ClearAllModuleVars( void );
     139                 :            : 
     140                 :            :     // Calls for error and break handler
     141                 :            :     static sal_uInt16   GetLine();
     142                 :            :     static sal_uInt16   GetCol1();
     143                 :            :     static sal_uInt16   GetCol2();
     144                 :            :     static void     SetErrorData( SbError nCode, sal_uInt16 nLine,
     145                 :            :                                   sal_uInt16 nCol1, sal_uInt16 nCol2 );
     146                 :            : 
     147                 :            :     // Specific to error handler
     148                 :            :     static void     MakeErrorText( SbError, const ::rtl::OUString& aMsg );
     149                 :            :     static const    String& GetErrorText();
     150                 :            :     static SbError  GetErrorCode();
     151                 :            :     static bool     IsCompilerError();
     152                 :            :     static sal_uInt16   GetVBErrorCode( SbError nError );
     153                 :            :     static SbError  GetSfxFromVBError( sal_uInt16 nError );
     154                 :          0 :     sal_Bool            IsBreak() const             { return bBreak; }
     155                 :            : 
     156                 :            :     static Link     GetGlobalErrorHdl();
     157                 :            :     static void     SetGlobalErrorHdl( const Link& rNewHdl );
     158                 :            :     Link            GetErrorHdl() const { return aErrorHdl; }
     159                 :            :     void            SetErrorHdl( const Link& r ) { aErrorHdl = r; }
     160                 :            : 
     161                 :            :     static void     SetGlobalBreakHdl( const Link& rNewHdl );
     162                 :            :     Link            GetBreakHdl() const { return aBreakHdl; }
     163                 :            :     void            SetBreakHdl( const Link& r ) { aBreakHdl = r; }
     164                 :            : 
     165                 :            :     SbxArrayRef     getUnoListeners( void );
     166                 :            : 
     167                 :            :     static SbxBase* FindSBXInCurrentScope( const String& rName );
     168                 :            :     static SbMethod* GetActiveMethod( sal_uInt16 nLevel = 0 );
     169                 :            :     static SbModule* GetActiveModule();
     170                 :            :     void SetVBAEnabled( sal_Bool bEnabled );
     171                 :            :     sal_Bool isVBAEnabled();
     172                 :            : 
     173                 :          0 :     SbxObjectRef getRTL( void ) { return pRtl; }
     174                 :       1380 :     sal_Bool IsDocBasic() { return bDocBasic; }
     175                 :            :     SbxVariable* VBAFind( const rtl::OUString& rName, SbxClassType t );
     176                 :            :     bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
     177                 :            :     void QuitAndExitApplication();
     178                 :        898 :     sal_Bool IsQuitApplication() { return bQuit; };
     179                 :            : 
     180                 :            :     static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
     181                 :            :         GetModelFromBasic( SbxObject* pBasic );
     182                 :            : };
     183                 :            : 
     184                 :            : #ifndef __SB_SBSTARBASICREF_HXX
     185                 :            : #define __SB_SBSTARBASICREF_HXX
     186                 :            : 
     187 [ +  - ][ +  - ]:      45237 : SV_DECL_IMPL_REF(StarBASIC)
         [ -  + ][ +  + ]
         [ +  - ][ +  - ]
     188                 :            : 
     189                 :            : #endif
     190                 :            : 
     191                 :            : #endif
     192                 :            : 
     193                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10