fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / basic / source / runtime / basrdll.cxx
blob59be1072d676bb8fa065d47e5f4cb0f87c7eecf5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
26 #include <basic/sbstar.hxx>
27 #include <basic/basrdll.hxx>
28 #include <basrid.hxx>
29 #include <sb.hrc>
31 BasResId::BasResId( sal_uInt32 nId ) :
32 ResId( nId, *(BASIC_DLL()->GetBasResMgr()) )
36 BasicDLL::BasicDLL()
38 BASIC_DLL() = this;
39 pBasResMgr = ResMgr::CreateResMgr("sb", Application::GetSettings().GetUILanguageTag() );
40 bDebugMode = false;
41 bBreakEnabled = true;
44 BasicDLL::~BasicDLL()
46 delete pBasResMgr;
49 void BasicDLL::EnableBreak( bool bEnable )
51 BasicDLL* pThis = BASIC_DLL();
52 DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
53 if ( pThis )
55 pThis->bBreakEnabled = bEnable;
59 void BasicDLL::SetDebugMode( bool bDebugMode )
61 BasicDLL* pThis = BASIC_DLL();
62 DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
63 if ( pThis )
65 pThis->bDebugMode = bDebugMode;
70 void BasicDLL::BasicBreak()
72 // bJustStopping: if there's someone pressing STOP like crazy umpteen times,
73 // but the Basic doesn't stop early enough, the box might appear more often...
74 static bool bJustStopping = false;
76 BasicDLL* pThis = BASIC_DLL();
77 DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
78 if ( pThis )
80 if ( StarBASIC::IsRunning() && !bJustStopping && ( pThis->bBreakEnabled || pThis->bDebugMode ) )
82 bJustStopping = true;
83 StarBASIC::Stop();
84 InfoBox( 0, BasResId(IDS_SBERR_TERMINATED).toString() ).Execute();
85 bJustStopping = false;
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */