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 : : #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 : :
26 : : #include <basic/sbstar.hxx>
27 : : #include <basic/basrdll.hxx>
28 : : #include <basrid.hxx>
29 : : #include <sb.hrc>
30 : :
31 : 0 : BasResId::BasResId( sal_uInt32 nId ) :
32 : 0 : ResId( nId, *(BASIC_DLL()->GetBasResMgr()) )
33 : : {
34 : 0 : }
35 : :
36 : 239 : BasicDLL::BasicDLL()
37 : : {
38 [ + - ]: 239 : BASIC_DLL() = this;
39 [ + - ][ + - ]: 239 : ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
40 [ + - ]: 239 : pBasResMgr = ResMgr::CreateResMgr("sb", aLocale );
41 : 239 : bDebugMode = sal_False;
42 : 239 : bBreakEnabled = sal_True;
43 : 239 : }
44 : :
45 : 164 : BasicDLL::~BasicDLL()
46 : : {
47 [ + - ]: 164 : delete pBasResMgr;
48 : 164 : }
49 : :
50 : 0 : void BasicDLL::EnableBreak( sal_Bool bEnable )
51 : : {
52 : 0 : BasicDLL* pThis = BASIC_DLL();
53 : : DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" );
54 [ # # ]: 0 : if ( pThis )
55 : 0 : pThis->bBreakEnabled = bEnable;
56 : 0 : }
57 : :
58 : 0 : void BasicDLL::SetDebugMode( sal_Bool bDebugMode )
59 : : {
60 : 0 : BasicDLL* pThis = BASIC_DLL();
61 : : DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" );
62 [ # # ]: 0 : if ( pThis )
63 : 0 : pThis->bDebugMode = bDebugMode;
64 : 0 : }
65 : :
66 : :
67 : 0 : void BasicDLL::BasicBreak()
68 : : {
69 : : // bJustStopping: if there's someone pressing STOP like crazy umpteen times,
70 : : // but the Basic doesn't stop early enough, the box might appear more often...
71 : : static bool bJustStopping = sal_False;
72 : :
73 : 0 : BasicDLL* pThis = BASIC_DLL();
74 : : DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" );
75 [ # # ]: 0 : if ( pThis )
76 : : {
77 [ # # ][ # # ]: 0 : if ( StarBASIC::IsRunning() && !bJustStopping && ( pThis->bBreakEnabled || pThis->bDebugMode ) )
[ # # ][ # # ]
[ # # ]
78 : : {
79 : 0 : bJustStopping = true;
80 : 0 : StarBASIC::Stop();
81 [ # # ][ # # ]: 0 : InfoBox( 0, BasResId(IDS_SBERR_TERMINATED).toString() ).Execute();
[ # # ][ # # ]
[ # # ][ # # ]
82 : 0 : bJustStopping = false;
83 : : }
84 : : }
85 : 0 : }
86 : :
87 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|