LibreOffice Module basic (master) 1
sbintern.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <basic/sbstar.hxx>
23#include <sbxfac.hxx>
24#include "sbunoobj.hxx"
27#include <config_features.h>
28#include <optional>
29
30namespace utl
31{
32 class TransliterationWrapper;
33}
34class SbUnoFactory;
35class SbTypeFactory;
36class SbOLEFactory;
37class SbFormFactory;
38class SbiInstance;
39class SbModule;
40class BasicManager;
41
42class SbiFactory final : public SbxFactory
43{
44public:
45 virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
46 virtual SbxObjectRef CreateObject( const OUString& ) override;
47};
48
50{
52
53 // types this module depends on because of use in Dim As New <type>
54 // needed for initialization order of class modules
55 std::vector< OUString > maRequiredTypes;
56
59 { clear(); }
60 void clear();
61};
62
63// #115824: Factory class to create class objects (type command)
64// Implementation: sb.cxx
65class SbClassFactory final : public SbxFactory
66{
68
69public:
71 virtual ~SbClassFactory() override;
72
73 void AddClassModule( SbModule* pClassModule );
74 void RemoveClassModule( SbModule* pClassModule );
75
76 virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
77 virtual SbxObjectRef CreateObject( const OUString& ) override;
78
79 SbModule* FindClass( const OUString& rClassName );
80};
81
82// Factory class to create user defined objects (type command)
83class SbTypeFactory final : public SbxFactory
84{
85public:
86 virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
87 virtual SbxObjectRef CreateObject( const OUString& ) override;
88};
89
90class SbFormFactory final : public SbxFactory
91{
92public:
93 virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
94 virtual SbxObjectRef CreateObject( const OUString& ) override;
95};
96
97// Factory class to create OLE objects
98class SbOLEFactory final : public SbxFactory
99{
100public:
101 virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
102 virtual SbxObjectRef CreateObject( const OUString& ) override;
103};
104
106{
108 SbiInstance* pInst; // all active runtime instances
109#if HAVE_FEATURE_SCRIPTING
110 std::optional<SbiFactory> pSbFac; // StarBASIC-Factory
111 std::optional<SbUnoFactory> pUnoFac; // Factory for Uno-Structs at DIM AS NEW
112 std::optional<SbTypeFactory>
113 pTypeFac; // Factory for user defined types
114 std::unique_ptr<SbClassFactory>
115 pClassFac; // Factory for user defined classes (based on class modules)
116 std::optional<SbOLEFactory>
117 pOLEFac; // Factory for OLE types
118 std::optional<SbFormFactory>
119 pFormFac; // Factory for user forms
120 std::unique_ptr<BasicManager> pAppBasMgr;
121#endif
122 SbModule* pMod; // currently active module
123 SbModule* pCompMod; // currently compiled module
124 short nInst; // number of BASICs
125 Link<StarBASIC*,bool> aErrHdl; // global error handler
128 sal_Int32 nLine;
129 sal_Int32 nCol1,nCol2; // from... to...
130 bool bCompilerError; // flag for compiler error
132 bool bRunInit; // true, if RunInit active from the Basic
133 OUString aErrMsg; // buffer for GetErrorText()
134 std::unique_ptr<::utl::TransliterationWrapper> pTransliterationWrapper; // For StrComp
136 StarBASIC* pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols
137
138 SbiGlobals();
140};
141
142// utility macros and routines
143
145
146/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SbxObjectRef CreateObject(const OUString &) override
Definition: sb.cxx:864
SbClassFactory()
Definition: sb.cxx:832
void RemoveClassModule(SbModule *pClassModule)
Definition: sb.cxx:853
void AddClassModule(SbModule *pClassModule)
Definition: sb.cxx:840
virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32) override
Definition: sb.cxx:858
virtual ~SbClassFactory() override
Definition: sb.cxx:837
SbModule * FindClass(const OUString &rClassName)
Definition: sb.cxx:888
SbxObjectRef xClassModules
Definition: sbintern.hxx:67
virtual SbxObjectRef CreateObject(const OUString &) override
Definition: sb.cxx:491
virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32) override
Definition: sb.cxx:485
virtual SbxObjectRef CreateObject(const OUString &) override
Definition: sb.cxx:476
virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32) override
Definition: sb.cxx:470
virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32) override
Definition: sb.cxx:579
virtual SbxObjectRef CreateObject(const OUString &) override
Definition: sb.cxx:585
virtual SbxObjectRef CreateObject(const OUString &) override
Definition: sb.cxx:439
virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32) override
Definition: sb.cxx:416
SbiGlobals * GetSbData()
Definition: sbintern.cxx:26
SbClassData()
Definition: sb.cxx:821
void clear()
Definition: sb.cxx:826
SbxArrayRef mxIfaces
Definition: sbintern.hxx:51
std::vector< OUString > maRequiredTypes
Definition: sbintern.hxx:55
Link< StarBASIC *, bool > aErrHdl
Definition: sbintern.hxx:125
short nInst
Definition: sbintern.hxx:124
std::unique_ptr<::utl::TransliterationWrapper > pTransliterationWrapper
Definition: sbintern.hxx:134
static SbiGlobals * pGlobals
Definition: sbintern.hxx:107
ErrCode nCode
Definition: sbintern.hxx:127
bool bCompilerError
Definition: sbintern.hxx:130
sal_Int32 nCol2
Definition: sbintern.hxx:129
bool bBlockCompilerError
Definition: sbintern.hxx:135
SbiInstance * pInst
Definition: sbintern.hxx:108
SbModule * pMod
Definition: sbintern.hxx:122
SbModule * pCompMod
Definition: sbintern.hxx:123
Link< StarBASIC *, BasicDebugFlags > aBreakHdl
Definition: sbintern.hxx:126
sal_Int32 nCol1
Definition: sbintern.hxx:129
sal_Int32 nLine
Definition: sbintern.hxx:128
bool bRunInit
Definition: sbintern.hxx:132
StarBASIC * pMSOMacroRuntimLib
Definition: sbintern.hxx:136
OUString aErrMsg
Definition: sbintern.hxx:133
bool bGlobalInitErr
Definition: sbintern.hxx:131