LCOV - code coverage report
Current view: top level - basic/source/runtime - basrdll.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 18 38 47.4 %
Date: 2014-11-03 Functions: 9 12 75.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             : #include <sbxbase.hxx>
      32             : 
      33         238 : struct BasicDLL::Impl
      34             : {
      35             :     bool        bDebugMode;
      36             :     bool        bBreakEnabled;
      37             : 
      38             :     ::boost::scoped_ptr<ResMgr> pBasResMgr;
      39             :     ::boost::scoped_ptr<SbxAppData> pSbxAppData;
      40             : 
      41         373 :     Impl()
      42             :         : bDebugMode(false)
      43             :         , bBreakEnabled(true)
      44         373 :         , pBasResMgr(ResMgr::CreateResMgr("sb", Application::GetSettings().GetUILanguageTag()))
      45         746 :         , pSbxAppData(new SbxAppData)
      46         373 :     { }
      47             : };
      48             : 
      49          40 : BasResId::BasResId( sal_uInt32 nId ) :
      50          40 :     ResId( nId, *(BASIC_DLL()->GetBasResMgr()) )
      51             : {
      52          40 : }
      53             : 
      54         373 : BasicDLL::BasicDLL()
      55         373 :     : m_pImpl(new Impl)
      56             : {
      57         373 :     BASIC_DLL() = this;
      58         373 : }
      59             : 
      60         238 : BasicDLL::~BasicDLL()
      61             : {
      62         238 : }
      63             : 
      64         110 : ResMgr* BasicDLL::GetBasResMgr() const { return m_pImpl->pBasResMgr.get(); }
      65             : 
      66           0 : void BasicDLL::EnableBreak( bool bEnable )
      67             : {
      68           0 :     BasicDLL* pThis = BASIC_DLL();
      69             :     DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
      70           0 :     if ( pThis )
      71             :     {
      72           0 :         pThis->m_pImpl->bBreakEnabled = bEnable;
      73             :     }
      74           0 : }
      75             : 
      76           0 : void BasicDLL::SetDebugMode( bool bDebugMode )
      77             : {
      78           0 :     BasicDLL* pThis = BASIC_DLL();
      79             :     DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
      80           0 :     if ( pThis )
      81             :     {
      82           0 :         pThis->m_pImpl->bDebugMode = bDebugMode;
      83             :     }
      84           0 : }
      85             : 
      86             : 
      87           0 : void BasicDLL::BasicBreak()
      88             : {
      89             :     // bJustStopping: if there's someone pressing STOP like crazy umpteen times,
      90             :     // but the Basic doesn't stop early enough, the box might appear more often...
      91             :     static bool bJustStopping = false;
      92             : 
      93           0 :     BasicDLL* pThis = BASIC_DLL();
      94             :     DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
      95           0 :     if ( pThis )
      96             :     {
      97           0 :         if (StarBASIC::IsRunning() && !bJustStopping
      98           0 :             && (pThis->m_pImpl->bBreakEnabled || pThis->m_pImpl->bDebugMode))
      99             :         {
     100           0 :             bJustStopping = true;
     101           0 :             StarBASIC::Stop();
     102           0 :             InfoBox( 0, BasResId(IDS_SBERR_TERMINATED).toString() ).Execute();
     103           0 :             bJustStopping = false;
     104             :         }
     105             :     }
     106           0 : }
     107             : 
     108      780950 : SbxAppData& GetSbxData_Impl()
     109             : {
     110      780950 :     return *BASIC_DLL()->m_pImpl->pSbxAppData;
     111        1203 : }
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10