LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / basic / source / inc / sbintern.hxx
blob0f1b4d3114b5abc68d9864429f16ccd8651d67b4
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 #pragma once
22 #include <basic/sbstar.hxx>
23 #include <sbxfac.hxx>
24 #include <unotools/transliterationwrapper.hxx>
25 #include <vcl/errcode.hxx>
26 #include <config_features.h>
28 namespace utl
30 class TransliterationWrapper;
32 class SbUnoFactory;
33 class SbTypeFactory;
34 class SbOLEFactory;
35 class SbFormFactory;
36 class SbiInstance;
37 class SbModule;
38 class BasicManager;
40 class SbiFactory final : public SbxFactory
42 public:
43 virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
44 virtual SbxObjectRef CreateObject( const OUString& ) override;
47 struct SbClassData
49 SbxArrayRef mxIfaces;
51 // types this module depends on because of use in Dim As New <type>
52 // needed for initialization order of class modules
53 std::vector< OUString > maRequiredTypes;
55 SbClassData();
56 ~SbClassData()
57 { clear(); }
58 void clear();
61 // #115824: Factory class to create class objects (type command)
62 // Implementation: sb.cxx
63 class SbClassFactory final : public SbxFactory
65 SbxObjectRef xClassModules;
67 public:
68 SbClassFactory();
69 virtual ~SbClassFactory() override;
71 void AddClassModule( SbModule* pClassModule );
72 void RemoveClassModule( SbModule* pClassModule );
74 virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
75 virtual SbxObjectRef CreateObject( const OUString& ) override;
77 SbModule* FindClass( const OUString& rClassName );
80 // Factory class to create user defined objects (type command)
81 class SbTypeFactory final : public SbxFactory
83 public:
84 virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
85 virtual SbxObjectRef CreateObject( const OUString& ) override;
88 class SbFormFactory final : public SbxFactory
90 public:
91 virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
92 virtual SbxObjectRef CreateObject( const OUString& ) override;
95 // Factory class to create OLE objects
96 class SbOLEFactory final : public SbxFactory
98 public:
99 virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
100 virtual SbxObjectRef CreateObject( const OUString& ) override;
103 struct SbiGlobals
105 static SbiGlobals* pGlobals;
106 SbiInstance* pInst; // all active runtime instances
107 std::unique_ptr<SbiFactory> pSbFac; // StarBASIC-Factory
108 std::unique_ptr<SbUnoFactory> pUnoFac; // Factory for Uno-Structs at DIM AS NEW
109 std::unique_ptr<SbTypeFactory>
110 pTypeFac; // Factory for user defined types
111 std::unique_ptr<SbClassFactory>
112 pClassFac; // Factory for user defined classes (based on class modules)
113 std::unique_ptr<SbOLEFactory>
114 pOLEFac; // Factory for OLE types
115 std::unique_ptr<SbFormFactory>
116 pFormFac; // Factory for user forms
117 SbModule* pMod; // currently active module
118 SbModule* pCompMod; // currently compiled module
119 short nInst; // number of BASICs
120 Link<StarBASIC*,bool> aErrHdl; // global error handler
121 Link<StarBASIC*,BasicDebugFlags> aBreakHdl; // global break handler
122 ErrCode nCode;
123 sal_Int32 nLine;
124 sal_Int32 nCol1,nCol2; // from... to...
125 bool bCompilerError; // flag for compiler error
126 bool bGlobalInitErr;
127 bool bRunInit; // true, if RunInit active from the Basic
128 OUString aErrMsg; // buffer for GetErrorText()
129 std::unique_ptr<::utl::TransliterationWrapper> pTransliterationWrapper; // For StrComp
130 bool bBlockCompilerError;
131 #if HAVE_FEATURE_SCRIPTING
132 std::unique_ptr<BasicManager> pAppBasMgr;
133 #endif
134 StarBASIC* pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols
136 SbiGlobals();
137 ~SbiGlobals();
140 // utility macros and routines
142 SbiGlobals* GetSbData();
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */