LCOV - code coverage report
Current view: top level - basic/source/runtime - basrdll.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 31 0.0 %
Date: 2014-04-14 Functions: 0 6 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             : #include <tools/shl.hxx>
      21             : #include <vcl/svapp.hxx>
      22             : #include <svl/solar.hrc>
      23             : #include <tools/debug.hxx>
      24             : #include <vcl/msgbox.hxx>
      25             : #include <vcl/settings.hxx>
      26             : 
      27             : #include <basic/sbstar.hxx>
      28             : #include <basic/basrdll.hxx>
      29             : #include <basrid.hxx>
      30             : #include <sb.hrc>
      31             : 
      32           0 : BasResId::BasResId( sal_uInt32 nId ) :
      33           0 :     ResId( nId, *(BASIC_DLL()->GetBasResMgr()) )
      34             : {
      35           0 : }
      36             : 
      37           0 : BasicDLL::BasicDLL()
      38             : {
      39           0 :     BASIC_DLL() = this;
      40           0 :     pBasResMgr = ResMgr::CreateResMgr("sb", Application::GetSettings().GetUILanguageTag() );
      41           0 :     bDebugMode = false;
      42           0 :     bBreakEnabled = true;
      43           0 : }
      44             : 
      45           0 : BasicDLL::~BasicDLL()
      46             : {
      47           0 :     delete pBasResMgr;
      48           0 : }
      49             : 
      50           0 : void BasicDLL::EnableBreak( bool bEnable )
      51             : {
      52           0 :     BasicDLL* pThis = BASIC_DLL();
      53             :     DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
      54           0 :     if ( pThis )
      55             :     {
      56           0 :         pThis->bBreakEnabled = bEnable;
      57             :     }
      58           0 : }
      59             : 
      60           0 : void BasicDLL::SetDebugMode( bool bDebugMode )
      61             : {
      62           0 :     BasicDLL* pThis = BASIC_DLL();
      63             :     DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
      64           0 :     if ( pThis )
      65             :     {
      66           0 :         pThis->bDebugMode = bDebugMode;
      67             :     }
      68           0 : }
      69             : 
      70             : 
      71           0 : void BasicDLL::BasicBreak()
      72             : {
      73             :     // bJustStopping: if there's someone pressing STOP like crazy umpteen times,
      74             :     // but the Basic doesn't stop early enough, the box might appear more often...
      75             :     static bool bJustStopping = false;
      76             : 
      77           0 :     BasicDLL* pThis = BASIC_DLL();
      78             :     DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
      79           0 :     if ( pThis )
      80             :     {
      81           0 :         if ( StarBASIC::IsRunning() && !bJustStopping && ( pThis->bBreakEnabled || pThis->bDebugMode ) )
      82             :         {
      83           0 :             bJustStopping = true;
      84           0 :             StarBASIC::Stop();
      85           0 :             InfoBox( 0, BasResId(IDS_SBERR_TERMINATED).toString() ).Execute();
      86           0 :             bJustStopping = false;
      87             :         }
      88             :     }
      89           0 : }
      90             : 
      91             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10