LCOV - code coverage report
Current view: top level - include/basic - sbstar.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 4 7 57.1 %
Date: 2014-11-03 Functions: 4 9 44.4 %
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_SBSTAR_HXX
      21             : #define INCLUDED_BASIC_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 <basic/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 BASIC_DLLPUBLIC StarBASIC : public SbxObject
      45             : {
      46             :     friend class SbiScanner;
      47             :     friend class SbiExpression; // Access to RTL
      48             :     friend class SbiInstance;
      49             :     friend class SbiRuntime;
      50             :     friend class DocBasicItem;
      51             : 
      52             :     SbxArrayRef     pModules;               // List of all modules
      53             :     SbxObjectRef    pRtl;               // Runtime Library
      54             :     SbxArrayRef     xUnoListeners;          // Listener handled by CreateUnoListener
      55             : 
      56             :    // Handler-Support:
      57             :     Link            aErrorHdl;              // Error handler
      58             :     Link            aBreakHdl;              // Breakpoint handler
      59             :     bool            bNoRtl;                 // if true: do not search RTL
      60             :     bool            bBreak;                 // if true: Break, otherwise Step
      61             :     bool            bDocBasic;
      62             :     bool            bVBAEnabled;
      63             :     BasicLibInfo*   pLibInfo;           // Info block for basic manager
      64             :     bool            bQuit;
      65             : 
      66             :     SbxObjectRef pVBAGlobals;
      67             :     BASIC_DLLPRIVATE SbxObject* getVBAGlobals( );
      68             : 
      69             :     BASIC_DLLPRIVATE void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic );
      70             : 
      71             : protected:
      72             :     bool                                CError( SbError, const OUString&, sal_Int32, sal_Int32, sal_Int32 );
      73             : private:
      74             :     BASIC_DLLPRIVATE bool               RTError( SbError, sal_Int32, sal_Int32, sal_Int32 );
      75             :     BASIC_DLLPRIVATE bool               RTError( SbError, const OUString& rMsg, sal_Int32, sal_Int32, sal_Int32 );
      76             :     BASIC_DLLPRIVATE sal_uInt16         BreakPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
      77             :     BASIC_DLLPRIVATE sal_uInt16         StepPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
      78             :     virtual bool LoadData( SvStream&, sal_uInt16 ) SAL_OVERRIDE;
      79             :     virtual bool StoreData( SvStream& ) const SAL_OVERRIDE;
      80             : 
      81             : protected:
      82             :     virtual bool        ErrorHdl();
      83             :     virtual sal_uInt16  BreakHdl();
      84             :     virtual ~StarBASIC();
      85             : 
      86             : public:
      87             : 
      88           0 :     SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASIC,1);
      89             :     TYPEINFO_OVERRIDE();
      90             : 
      91             :     StarBASIC( StarBASIC* pParent = NULL, bool bIsDocBasic = false );
      92             : 
      93             :     // #51727 SetModified overridden so that the Modfied-State is
      94             :         // not delivered to Parent.
      95             :     virtual void SetModified( bool ) SAL_OVERRIDE;
      96             : 
      97             :     void* operator  new( size_t );
      98             :     void operator   delete( void* );
      99             : 
     100             :     virtual void    Insert( SbxVariable* ) SAL_OVERRIDE;
     101             :     using SbxObject::Remove;
     102             :     virtual void    Remove( SbxVariable* ) SAL_OVERRIDE;
     103             :     virtual void    Clear() SAL_OVERRIDE;
     104             : 
     105             :     BasicLibInfo*   GetLibInfo()                    { return pLibInfo;  }
     106             :     void            SetLibInfo( BasicLibInfo* p )   { pLibInfo = p;     }
     107             : 
     108             :     // Compiler-Interface
     109             :     SbModule*       MakeModule( const OUString& rName, const OUString& rSrc );
     110             :     SbModule*       MakeModule32( const OUString& rName, const OUString& rSrc );
     111             :     SbModule*       MakeModule32( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, const OUString& rSrc );
     112             :     bool            Compile( SbModule* );
     113             :     static void     Stop();
     114             :     static void     Error( SbError );
     115             :     static void     Error( SbError, const OUString& rMsg );
     116             :     static void     FatalError( SbError );
     117             :     static void     FatalError( SbError, const OUString& rMsg );
     118             :     static bool     IsRunning();
     119             :     static SbError  GetErrBasic();
     120             :     // #66536 make additional message accessible by RTL function Error
     121             :     static OUString GetErrorMsg();
     122             :     static sal_Int32 GetErl();
     123             : 
     124             :     virtual SbxVariable* Find( const OUString&, SbxClassType ) SAL_OVERRIDE;
     125             :     virtual bool Call( const OUString&, SbxArray* = NULL ) SAL_OVERRIDE;
     126             : 
     127        3632 :     SbxArray*       GetModules() { return pModules; }
     128        6678 :     SbxObject*      GetRtl()     { return pRtl;     }
     129             :     SbModule*       FindModule( const OUString& );
     130             :     // Run init code of all modules (including the inserted Doc-Basics)
     131             :     void            InitAllModules( StarBASIC* pBasicNotToInit = NULL );
     132             :     void            DeInitAllModules( void );
     133             :     void            ClearAllModuleVars( void );
     134             : 
     135             :     // Calls for error and break handler
     136             :     static sal_uInt16 GetLine();
     137             :     static sal_uInt16 GetCol1();
     138             :     static sal_uInt16 GetCol2();
     139             :     static void     SetErrorData( SbError nCode, sal_uInt16 nLine,
     140             :                                   sal_uInt16 nCol1, sal_uInt16 nCol2 );
     141             : 
     142             :     // Specific to error handler
     143             :     static void     MakeErrorText( SbError, const OUString& aMsg );
     144             :     static const    OUString& GetErrorText();
     145             :     static SbError  GetErrorCode();
     146             :     static bool     IsCompilerError();
     147             :     static sal_uInt16 GetVBErrorCode( SbError nError );
     148             :     static SbError  GetSfxFromVBError( sal_uInt16 nError );
     149           0 :     bool            IsBreak() const             { return bBreak; }
     150             : 
     151             :     static Link     GetGlobalErrorHdl();
     152             :     static void     SetGlobalErrorHdl( const Link& rNewHdl );
     153             :     Link            GetErrorHdl() const { return aErrorHdl; }
     154             :     void            SetErrorHdl( const Link& r ) { aErrorHdl = r; }
     155             : 
     156             :     static void     SetGlobalBreakHdl( const Link& rNewHdl );
     157             :     Link            GetBreakHdl() const { return aBreakHdl; }
     158             :     void            SetBreakHdl( const Link& r ) { aBreakHdl = r; }
     159             : 
     160             :     SbxArrayRef     getUnoListeners( void );
     161             : 
     162             :     static SbxBase* FindSBXInCurrentScope( const OUString& rName );
     163             :     static SbMethod* GetActiveMethod( sal_uInt16 nLevel = 0 );
     164             :     static SbModule* GetActiveModule();
     165             :     void SetVBAEnabled( bool bEnabled );
     166             :     bool isVBAEnabled();
     167             : 
     168           0 :     SbxObjectRef getRTL( void ) { return pRtl; }
     169        4542 :     bool IsDocBasic() { return bDocBasic; }
     170             :     SbxVariable* VBAFind( const OUString& rName, SbxClassType t );
     171             :     bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
     172             :     void QuitAndExitApplication();
     173        2430 :     bool IsQuitApplication() { return bQuit; };
     174             : 
     175             :     static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
     176             :         GetModelFromBasic( SbxObject* pBasic );
     177             : 
     178             :     static void DetachAllDocBasicItems();
     179             : };
     180             : 
     181             : typedef tools::SvRef<StarBASIC> StarBASICRef;
     182             : 
     183             : #endif
     184             : 
     185             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10