summaryrefslogtreecommitdiff
path: root/basic/source/inc
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/inc')
-rw-r--r--basic/source/inc/basiccharclass.hxx5
-rw-r--r--basic/source/inc/buffer.hxx39
-rw-r--r--basic/source/inc/codegen.hxx29
-rw-r--r--basic/source/inc/date.hxx5
-rw-r--r--basic/source/inc/dlgcont.hxx29
-rw-r--r--basic/source/inc/errobject.hxx17
-rw-r--r--basic/source/inc/eventatt.hxx5
-rw-r--r--basic/source/inc/expr.hxx55
-rw-r--r--basic/source/inc/filefmt.hxx15
-rw-r--r--basic/source/inc/image.hxx26
-rw-r--r--basic/source/inc/iosys.hxx15
-rw-r--r--basic/source/inc/namecont.hxx102
-rw-r--r--basic/source/inc/opcodes.hxx5
-rw-r--r--basic/source/inc/parser.hxx5
-rw-r--r--basic/source/inc/propacc.hxx10
-rw-r--r--basic/source/inc/rtlproto.hxx13
-rw-r--r--basic/source/inc/runtime.hxx62
-rw-r--r--basic/source/inc/sbintern.hxx68
-rw-r--r--basic/source/inc/sbjsmeth.hxx13
-rw-r--r--basic/source/inc/sbjsmod.hxx17
-rw-r--r--basic/source/inc/sbunoobj.hxx61
-rw-r--r--basic/source/inc/sbxmod.hxx5
-rw-r--r--basic/source/inc/scanner.hxx18
-rw-r--r--basic/source/inc/scriptcont.hxx31
-rw-r--r--basic/source/inc/stdobj.hxx23
-rw-r--r--basic/source/inc/symtbl.hxx11
-rw-r--r--basic/source/inc/token.hxx7
27 files changed, 336 insertions, 355 deletions
diff --git a/basic/source/inc/basiccharclass.hxx b/basic/source/inc/basiccharclass.hxx
index 3b8109b89192..e58b71c1a2c6 100644
--- a/basic/source/inc/basiccharclass.hxx
+++ b/basic/source/inc/basiccharclass.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_BASICCHARCLASS_HXX
-#define INCLUDED_BASIC_SOURCE_INC_BASICCHARCLASS_HXX
+#pragma once
#include <sal/types.h>
@@ -31,6 +30,4 @@ namespace BasicCharClass
bool isWhitespace( sal_Unicode c );
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/buffer.hxx b/basic/source/inc/buffer.hxx
index 89d664453cef..5c555d74c089 100644
--- a/basic/source/inc/buffer.hxx
+++ b/basic/source/inc/buffer.hxx
@@ -17,37 +17,36 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_BUFFER_HXX
-#define INCLUDED_BASIC_SOURCE_INC_BUFFER_HXX
+#pragma once
+#include <rtl/ustring.hxx>
#include <sal/types.h>
-#include <memory>
+#include <comphelper/errcode.hxx>
+#include <vector>
-class SbiParser;
+// Stores all numbers big endian
class SbiBuffer {
- SbiParser* pParser; // for error messages
- std::unique_ptr<char[]> pBuf;
- char* pCur;
- sal_uInt32 nOff;
- sal_uInt32 nSize;
- short nInc;
- bool Check( sal_Int32 );
+ std::vector<sal_uInt8> m_aBuf;
+ ErrCode m_aErrCode;
+ OUString m_sErrMsg;
+
+ template <typename T> void append(T n);
+
public:
- SbiBuffer( SbiParser*, short ); // increment
- ~SbiBuffer();
+ SbiBuffer() { m_aBuf.reserve(1024); }
void Patch( sal_uInt32, sal_uInt32 );
void Chain( sal_uInt32 );
void operator += (sal_Int8); // save character
void operator += (sal_Int16); // save integer
- bool operator += (sal_uInt8); // save character
- bool operator += (sal_uInt16); // save integer
- bool operator += (sal_uInt32); // save integer
+ void operator += (sal_uInt8); // save character
+ void operator += (sal_uInt16); // save integer
+ void operator += (sal_uInt32); // save integer
void operator += (sal_Int32); // save integer
- char* GetBuffer(); // give out buffer (delete yourself!)
- sal_uInt32 GetSize() const { return nOff; }
+ std::vector<sal_uInt8>&& GetBuffer() { return std::move(m_aBuf); } // pass ownership
+ sal_uInt32 GetSize() const { return m_aBuf.size(); }
+ const ErrCode & GetErrCode() const { return m_aErrCode; }
+ const OUString & GetErrMessage() const { return m_sErrMsg; }
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx
index 857968e26e15..e9e06216014b 100644
--- a/basic/source/inc/codegen.hxx
+++ b/basic/source/inc/codegen.hxx
@@ -17,14 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_CODEGEN_HXX
-#define INCLUDED_BASIC_SOURCE_INC_CODEGEN_HXX
+#pragma once
-class SbiParser;
-class SbModule;
#include "opcodes.hxx"
#include "buffer.hxx"
+class SbiParser;
+class SbModule;
+
class SbiCodeGen {
SbiParser* pParser; // for error messages, line, column etc.
SbModule& rMod;
@@ -34,7 +34,7 @@ class SbiCodeGen {
bool bStmnt; // true: statement-opcode is pending
public:
- SbiCodeGen( SbModule&, SbiParser*, short );
+ SbiCodeGen(SbModule&, SbiParser*);
SbiParser* GetParser() { return pParser; }
SbModule& GetModule() { return rMod; }
sal_uInt32 Gen( SbiOpcode );
@@ -61,18 +61,21 @@ template < class T, class S >
class PCodeBuffConvertor
{
T m_nSize;
- sal_uInt8* m_pStart;
- sal_uInt8* m_pCnvtdBuf;
- S m_nCnvtdSize;
+ const sal_uInt8* m_pStart;
+ std::vector<sal_uInt8> m_aCnvtdBuf;
PCodeBuffConvertor(const PCodeBuffConvertor& ) = delete;
PCodeBuffConvertor& operator = ( const PCodeBuffConvertor& ) = delete;
public:
- PCodeBuffConvertor( sal_uInt8* pCode, T nSize ): m_nSize( nSize ), m_pStart( pCode ), m_pCnvtdBuf( nullptr ), m_nCnvtdSize( 0 ){ convert(); }
- S GetSize(){ return m_nCnvtdSize; }
+ PCodeBuffConvertor(const sal_uInt8* pCode, T nSize)
+ : m_nSize(nSize)
+ , m_pStart(pCode)
+ {
+ convert();
+ }
void convert();
- // Caller owns the buffer returned
- sal_uInt8* GetBuffer() { return m_pCnvtdBuf; }
+ // pass ownership
+ std::vector<sal_uInt8>&& GetBuffer() { return std::move(m_aCnvtdBuf); }
};
// #111897 PARAM_INFO flags start at 0x00010000 to not
@@ -80,6 +83,4 @@ public:
#define PARAM_INFO_PARAMARRAY 0x0010000
#define PARAM_INFO_WITHBRACKETS 0x0020000
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/date.hxx b/basic/source/inc/date.hxx
index 1a994ca3fa0c..4b6cb115fbbf 100644
--- a/basic/source/inc/date.hxx
+++ b/basic/source/inc/date.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_DATE_HXX
-#define INCLUDED_BASIC_SOURCE_INC_DATE_HXX
+#pragma once
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/Time.hpp>
@@ -56,6 +55,4 @@ void SbxDateFromUNOTime( SbxValue*, const css::util::Time& );
css::util::DateTime SbxDateToUNODateTime( const SbxValue* );
void SbxDateFromUNODateTime( SbxValue*, const css::util::DateTime& );
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx
index 582e462ab93e..e66a23701759 100644
--- a/basic/source/inc/dlgcont.hxx
+++ b/basic/source/inc/dlgcont.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_DLGCONT_HXX
-#define INCLUDED_BASIC_SOURCE_INC_DLGCONT_HXX
+#pragma once
#include "namecont.hxx"
@@ -32,11 +31,11 @@ namespace basic
{
-class SfxDialogLibraryContainer : public SfxLibraryContainer
+class SfxDialogLibraryContainer final : public SfxLibraryContainer
{
// Methods to distinguish between different library types
- virtual SfxLibrary* implCreateLibrary( const OUString& aName ) override;
- virtual SfxLibrary* implCreateLibraryLink
+ virtual rtl::Reference<SfxLibrary> implCreateLibrary( const OUString& aName ) override;
+ virtual rtl::Reference<SfxLibrary> implCreateLibraryLink
( const OUString& aName, const OUString& aLibInfoFileURL,
const OUString& StorageURL, bool ReadOnly ) override;
virtual css::uno::Any createEmptyLibraryElement() override;
@@ -57,14 +56,14 @@ class SfxDialogLibraryContainer : public SfxLibraryContainer
virtual void importFromOldStorage( const OUString& aFile ) override;
- virtual SfxLibraryContainer* createInstanceImpl() override;
+ virtual rtl::Reference<SfxLibraryContainer> createInstanceImpl() override;
virtual void onNewRootStorage() override;
- virtual const char* getInfoFileName() const override;
- virtual const char* getOldInfoFileName() const override;
- virtual const char* getLibElementFileExtension() const override;
- virtual const char* getLibrariesDir() const override;
+ virtual OUString getInfoFileName() const override;
+ virtual OUString getOldInfoFileName() const override;
+ virtual OUString getLibElementFileExtension() const override;
+ virtual OUString getLibrariesDir() const override;
public:
SfxDialogLibraryContainer();
@@ -89,7 +88,7 @@ public:
typedef ::cppu::ImplHelper1 < css::resource::XStringResourceSupplier
> SfxDialogLibrary_BASE;
-class SfxDialogLibrary :public SfxLibrary
+class SfxDialogLibrary final : public SfxLibrary
,public SfxDialogLibrary_BASE
{
SfxDialogLibraryContainer* m_pParent;
@@ -109,7 +108,7 @@ public:
SfxDialogLibrary
(
ModifiableHelper& _rModifiable,
- const OUString& aName,
+ OUString aName,
const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& xSFI,
SfxDialogLibraryContainer* pParent
);
@@ -117,7 +116,7 @@ public:
SfxDialogLibrary
(
ModifiableHelper& _rModifiable,
- const OUString& aName,
+ OUString aName,
const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& xSFI,
const OUString& aLibInfoFileURL, const OUString& aStorageURL, bool ReadOnly,
SfxDialogLibraryContainer* pParent
@@ -141,12 +140,10 @@ public:
static bool containsValidDialog( const css::uno::Any& aElement );
-protected:
+private:
virtual bool isLibraryElementValid(const css::uno::Any& rElement) const override;
};
} // namespace basic
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/errobject.hxx b/basic/source/inc/errobject.hxx
index 65c4722e3319..db46f5e971e2 100644
--- a/basic/source/inc/errobject.hxx
+++ b/basic/source/inc/errobject.hxx
@@ -17,27 +17,24 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_ERROBJECT_HXX
-#define INCLUDED_BASIC_SOURCE_INC_ERROBJECT_HXX
+#pragma once
#include "sbunoobj.hxx"
#include <ooo/vba/XErrObject.hpp>
-
-class SbxErrObject : public SbUnoObject
+class SbxErrObject final : public SbUnoObject
{
class ErrObject* m_pErrObject;
- css::uno::Reference< ooo::vba::XErrObject > m_xErr;
+ css::uno::Reference<ooo::vba::XErrObject> m_xErr;
- SbxErrObject( const OUString& aName_, const css::uno::Any& aUnoObj_ );
+ SbxErrObject(const OUString& aName_, const css::uno::Any& aUnoObj_);
virtual ~SbxErrObject() override;
public:
- static SbxVariableRef const & getErrObject();
- static css::uno::Reference< ooo::vba::XErrObject > const & getUnoErrObject();
+ static SbxVariableRef const& getErrObject();
+ static css::uno::Reference<ooo::vba::XErrObject> const& getUnoErrObject();
/// @throws css::uno::RuntimeException
- void setNumberAndDescription( ::sal_Int32 _number, const OUString& _description );
+ void setNumberAndDescription(::sal_Int32 _number, const OUString& _description);
};
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/eventatt.hxx b/basic/source/inc/eventatt.hxx
index b38c83c597ce..4ea3e044069f 100644
--- a/basic/source/inc/eventatt.hxx
+++ b/basic/source/inc/eventatt.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_EVENTATT_HXX
-#define INCLUDED_BASIC_SOURCE_INC_EVENTATT_HXX
+#pragma once
#include <sal/config.h>
@@ -29,6 +28,4 @@ class SbxArray;
// and attach events.
void RTL_Impl_CreateUnoDialog(SbxArray& rPar);
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index d83594c4951f..d1e7fbcfa25d 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_EXPR_HXX
-#define INCLUDED_BASIC_SOURCE_INC_EXPR_HXX
+#pragma once
#include <memory>
@@ -86,6 +85,25 @@ enum RecursiveMode
PREVENT_CALL
};
+class SbiExprList final { // class for parameters and dims
+ std::vector<std::unique_ptr<SbiExpression>> aData;
+ short nDim;
+ bool bError;
+ bool bBracket;
+public:
+ SbiExprList();
+ ~SbiExprList();
+ static SbiExprListPtr ParseParameters(SbiParser*, bool bStandaloneExpression = false, bool bPar = true);
+ static SbiExprListPtr ParseDimList( SbiParser* );
+ bool IsBracket() const { return bBracket; }
+ bool IsValid() const { return !bError; }
+ short GetSize() const { return aData.size(); }
+ short GetDims() const { return nDim; }
+ SbiExpression* Get( size_t );
+ void Gen( SbiCodeGen& rGen); // code generation
+ void addExpression( std::unique_ptr<SbiExpression>&& pExpr );
+};
+
class SbiExprNode final { // operators (and operands)
friend class SbiExpression;
friend class SbiConstExpression;
@@ -115,7 +133,7 @@ class SbiExprNode final { // operators (and operands)
public:
SbiExprNode();
SbiExprNode( double, SbxDataType );
- SbiExprNode( const OUString& );
+ SbiExprNode( OUString );
SbiExprNode( const SbiSymDef&, SbxDataType, SbiExprListPtr = nullptr );
SbiExprNode( std::unique_ptr<SbiExprNode>, SbiToken, std::unique_ptr<SbiExprNode> );
SbiExprNode( std::unique_ptr<SbiExprNode>, sal_uInt16 ); // #120061 TypeOf
@@ -153,11 +171,11 @@ protected:
std::unique_ptr<SbiExprNode> pExpr; // expression tree
SbiExprType eCurExpr; // type of expression
SbiExprMode m_eMode; // expression context
- bool bBased; // true: easy DIM-part (+BASE)
- bool bError;
- bool bByVal; // true: ByVal-Parameter
- bool bBracket; // true: Parameter list with brackets
- sal_uInt16 nParenLevel;
+ bool bBased = false; // true: easy DIM-part (+BASE)
+ bool bError = false;
+ bool bByVal = false; // true: ByVal-Parameter
+ bool bBracket = false; // true: Parameter list with brackets
+ sal_uInt16 nParenLevel = 0;
std::unique_ptr<SbiExprNode> Term( const KeywordSymbolInfo* pKeywordSymbolInfo = nullptr );
std::unique_ptr<SbiExprNode> ObjTerm( SbiSymDef& );
std::unique_ptr<SbiExprNode> Operand( bool bUsedForTypeOf = false );
@@ -206,25 +224,4 @@ public: // numeric constant
short GetShortValue();
};
-class SbiExprList final { // class for parameters and dims
- std::vector<std::unique_ptr<SbiExpression>> aData;
- short nDim;
- bool bError;
- bool bBracket;
-public:
- SbiExprList();
- ~SbiExprList();
- static SbiExprListPtr ParseParameters(SbiParser*, bool bStandaloneExpression = false, bool bPar = true);
- static SbiExprListPtr ParseDimList( SbiParser* );
- bool IsBracket() const { return bBracket; }
- bool IsValid() const { return !bError; }
- short GetSize() const { return aData.size(); }
- short GetDims() const { return nDim; }
- SbiExpression* Get( size_t );
- void Gen( SbiCodeGen& rGen); // code generation
- void addExpression( std::unique_ptr<SbiExpression>&& pExpr );
-};
-
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/filefmt.hxx b/basic/source/inc/filefmt.hxx
index eb1990087d9e..38dfa95754f3 100644
--- a/basic/source/inc/filefmt.hxx
+++ b/basic/source/inc/filefmt.hxx
@@ -17,10 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_FILEFMT_HXX
-#define INCLUDED_BASIC_SOURCE_INC_FILEFMT_HXX
-
-class SvStream;
+#pragma once
// Version 2: data type of the return value for publics
// Version 3: new opcodes
@@ -43,11 +40,13 @@ class SvStream;
// Version 13: tdf#94617 store methods nStart information greater than sal_Int16 limit
// tdf#57113 store UTF-16 strings after legacy 1-byte-encoded strings in pool (no
// version number bump for backward compatibility; relies on magic number)
+// tdf#142460: properly handle boolean values in string pool (no
+// version number bump for backward compatibility; relies on
+// new integer type suffix 'b')
//
-#define B_LEGACYVERSION 0x00000011
-#define B_EXT_IMG_VERSION 0x00000012
-#define B_CURVERSION 0x00000013
+#define B_IMG_VERSION_12 0x00000012
+#define B_IMG_VERSION_13 0x00000013
// The file contains either a module- or a library-record.
// Those records contain further records. Every record's got
@@ -187,6 +186,4 @@ enum class FileOffset {
// sal_Int32 lower bound
// sal_Int32 upper bound
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index ee1aaa4168b6..5a4522bd91bf 100644
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -17,13 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_IMAGE_HXX
-#define INCLUDED_BASIC_SOURCE_INC_IMAGE_HXX
+#pragma once
#include <basic/sbx.hxx>
#include <rtl/ustring.hxx>
#include "filefmt.hxx"
#include <o3tl/typed_flags_set.hxx>
+#include <cstddef>
+#include <vector>
// This class reads in the image that's been produced by the compiler
// and manages the access to the single elements.
@@ -48,22 +49,20 @@ class SbiImage {
SbxArrayRef rEnums; // Enum types
std::vector<sal_uInt32> mvStringOffsets; // StringId-Offsets
std::unique_ptr<sal_Unicode[]> pStrings; // StringPool
- std::unique_ptr<char[]> pCode; // Code-Image
- std::unique_ptr<char[]> pLegacyPCode; // Code-Image
+ std::vector<sal_uInt8> aCode; // Code-Image
+ std::vector<sal_uInt8> aLegacyPCode; // Code-Image
bool bError;
SbiImageFlags nFlags;
sal_uInt32 nStringSize;
- sal_uInt32 nCodeSize;
- sal_uInt16 nLegacyCodeSize;
sal_uInt16 nDimBase; // OPTION BASE value
rtl_TextEncoding eCharSet;
// temporary management-variable:
- short nStringIdx;
+ std::size_t nStringIdx;
sal_uInt32 nStringOff; // current Pos in the stringbuffer
// routines for the compiler:
void MakeStrings( short ); // establish StringPool
void AddString( const OUString& );
- void AddCode( std::unique_ptr<char[]>, sal_uInt32 );
+ void AddCode(std::vector<sal_uInt8>&&);
void AddType(SbxObject const *);
void AddEnum(SbxObject *);
@@ -80,13 +79,13 @@ public:
bool Load( SvStream&, sal_uInt32& nVer );
// nVer is set to version
// of image
- bool Save( SvStream&, sal_uInt32 = B_CURVERSION );
+ bool Save( SvStream&, sal_uInt32 );
bool IsError() const { return bError; }
- const char* GetCode() const { return pCode.get(); }
- sal_uInt32 GetCodeSize() const { return nCodeSize; }
+ const sal_uInt8* GetCode() const { return aCode.data(); }
+ sal_uInt32 GetCodeSize() const { return aCode.size(); }
sal_uInt16 GetBase() const { return nDimBase; }
- OUString GetString( short nId ) const;
+ OUString GetString( sal_uInt32 nId, SbxDataType *eType = nullptr ) const;
const SbxObject* FindType (const OUString& aTypeName) const;
const SbxArrayRef& GetEnums() const { return rEnums; }
@@ -97,8 +96,7 @@ public:
sal_uInt32 CalcNewOffset( sal_Int16 nOffset );
void ReleaseLegacyBuffer();
bool ExceedsLegacyLimits();
+ bool ExceedsImgVersion12Limits();
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx
index 4931b86a3e94..ca5c6b275bcc 100644
--- a/basic/source/inc/iosys.hxx
+++ b/basic/source/inc/iosys.hxx
@@ -17,10 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_IOSYS_HXX
-#define INCLUDED_BASIC_SOURCE_INC_IOSYS_HXX
+#pragma once
#include <memory>
+#include <string_view>
+
#include <tools/stream.hxx>
#include <o3tl/typed_flags_set.hxx>
@@ -59,7 +60,7 @@ class SbiStream
public:
SbiStream();
~SbiStream();
- ErrCode const & Open( const OString&, StreamMode, SbiStreamFlags, short );
+ ErrCode const & Open( std::string_view, StreamMode, SbiStreamFlags, short );
ErrCode const & Close();
ErrCode Read(OString&, sal_uInt16 = 0, bool bForceReadingPerByte=false);
ErrCode const & Read( char& );
@@ -87,7 +88,7 @@ class SbiIoSystem
short nChan;
ErrCode nError;
void ReadCon(OString&);
- void WriteCon(const OUString&);
+ void WriteCon(std::u16string_view);
public:
SbiIoSystem();
~SbiIoSystem() COVERITY_NOEXCEPT_FALSE;
@@ -97,16 +98,14 @@ public:
void SetChannel( short n ) { nChan = n; }
short GetChannel() const { return nChan;}
void ResetChannel() { nChan = 0; }
- void Open( short, const OString&, StreamMode, SbiStreamFlags, short );
+ void Open( short, std::string_view, StreamMode, SbiStreamFlags, short );
void Close();
void Read(OString&);
char Read();
- void Write(const OUString&);
+ void Write(std::u16string_view);
// 0 == bad channel or no SvStream (nChannel=0..CHANNELS-1)
SbiStream* GetStream( short nChannel ) const;
void CloseAll(); // JSM
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 3a86f059c839..4db38ac881a4 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_NAMECONT_HXX
-#define INCLUDED_BASIC_SOURCE_INC_NAMECONT_HXX
+#pragma once
#include <unordered_map>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -38,32 +37,34 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/deployment/XPackage.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/script/vba/XVBAScriptListener.hpp>
#include <com/sun/star/util/XChangesNotifier.hpp>
#include <osl/mutex.hxx>
#include <unotools/eventlisteneradapter.hxx>
+#include <comphelper/compbase.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/weakref.hxx>
-#include <cppuhelper/component.hxx>
#include <cppuhelper/basemutex.hxx>
#include <rtl/ref.hxx>
-#include <comphelper/listenernotification.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <xmlscript/xmllib_imexp.hxx>
class BasicManager;
namespace basic
{
-typedef ::cppu::WeakImplHelper<
+typedef ::comphelper::WeakImplHelper<
css::container::XNameContainer,
css::container::XContainer,
css::util::XChangesNotifier > NameContainer_BASE;
-class NameContainer : public ::cppu::BaseMutex, public NameContainer_BASE
+class NameContainer final : public NameContainer_BASE
{
typedef std::unordered_map < OUString, sal_Int32 > NameContainerNameMap;
@@ -75,16 +76,14 @@ class NameContainer : public ::cppu::BaseMutex, public NameContainer_BASE
css::uno::Type mType;
css::uno::XInterface* mpxEventSource;
- ::comphelper::OInterfaceContainerHelper2 maContainerListeners;
- ::comphelper::OInterfaceContainerHelper2 maChangesListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::container::XContainerListener> maContainerListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::util::XChangesListener> maChangesListeners;
public:
NameContainer( const css::uno::Type& rType )
: mnElementCount( 0 )
, mType( rType )
, mpxEventSource( nullptr )
- , maContainerListeners( m_aMutex )
- , maChangesListeners( m_aMutex )
{}
void setEventSource( css::uno::XInterface* pxEventSource )
@@ -130,7 +129,7 @@ public:
class ModifiableHelper
{
private:
- ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> m_aModifyListeners;
::cppu::OWeakObject& m_rEventSource;
bool mbModified;
@@ -143,7 +142,7 @@ public:
}
bool isModified() const { return mbModified; }
- void setModified( bool _bModified );
+ void setModified( bool _bModified );
void addModifyListener( const css::uno::Reference< css::util::XModifyListener >& _rxListener )
{
@@ -157,21 +156,8 @@ public:
};
-typedef ::comphelper::OListenerContainerBase<
- css::script::vba::XVBAScriptListener,
- css::script::vba::VBAScriptEvent > VBAScriptListenerContainer_BASE;
-
-class VBAScriptListenerContainer : public VBAScriptListenerContainer_BASE
-{
-public:
- explicit VBAScriptListenerContainer( ::osl::Mutex& rMutex );
-
-private:
- virtual bool implTypedNotify(
- const css::uno::Reference< css::script::vba::XVBAScriptListener >& rxListener,
- const css::script::vba::VBAScriptEvent& rEvent ) override;
-};
-
+typedef ::comphelper::OInterfaceContainerHelper3<
+ css::script::vba::XVBAScriptListener > VBAScriptListenerContainer;
class SfxLibrary;
@@ -184,7 +170,8 @@ typedef ::cppu::WeakComponentImplHelper<
css::container::XContainer,
css::script::XLibraryQueryExecutable,
css::script::vba::XVBACompatibility,
- css::lang::XServiceInfo > SfxLibraryContainer_BASE;
+ css::lang::XServiceInfo,
+ css::beans::XPropertySet> SfxLibraryContainer_BASE;
class SfxLibraryContainer
: public ::cppu::BaseMutex
@@ -195,6 +182,7 @@ class SfxLibraryContainer
sal_Int32 mnRunningVBAScripts;
bool mbVBACompat;
OUString msProjectName;
+ rtl_TextEncoding meVBATextEncoding;
protected:
css::uno::Reference< css::uno::XComponentContext > mxContext;
css::uno::Reference< css::ucb::XSimpleFileAccess3 > mxSFI;
@@ -228,14 +216,14 @@ protected:
} meInitMode;
void implStoreLibrary( SfxLibrary* pLib,
- const OUString& rName,
+ std::u16string_view rName,
const css::uno::Reference< css::embed::XStorage >& rStorage );
// New variant for library export
void implStoreLibrary( SfxLibrary* pLib,
- const OUString& rName,
+ std::u16string_view rName,
const css::uno::Reference< css::embed::XStorage >& rStorage,
- const OUString& rTargetURL,
+ std::u16string_view rTargetURL,
const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& rToUseSFI,
const css::uno::Reference< css::task::XInteractionHandler >& rHandler );
@@ -245,7 +233,7 @@ protected:
// New variant for library export
void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
const css::uno::Reference< css::embed::XStorage >& xStorage,
- const OUString& aTargetURL,
+ std::u16string_view aTargetURL,
const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& rToUseSFI );
bool implLoadLibraryIndexFile( SfxLibrary* pLib,
@@ -256,8 +244,8 @@ protected:
void implImportLibDescriptor( SfxLibrary* pLib, ::xmlscript::LibDescriptor const & rLib );
// Methods to distinguish between different library types
- virtual SfxLibrary* implCreateLibrary( const OUString& aName ) = 0;
- virtual SfxLibrary* implCreateLibraryLink
+ virtual rtl::Reference<SfxLibrary> implCreateLibrary( const OUString& aName ) = 0;
+ virtual rtl::Reference<SfxLibrary> implCreateLibraryLink
( const OUString& aName, const OUString& aLibInfoFileURL,
const OUString& StorageURL, bool ReadOnly ) = 0;
virtual css::uno::Any createEmptyLibraryElement() = 0;
@@ -298,20 +286,20 @@ protected:
// #56666, Creates another library container
// instance of the same derived class
- virtual SfxLibraryContainer* createInstanceImpl() = 0;
+ virtual rtl::Reference<SfxLibraryContainer> createInstanceImpl() = 0;
// Interface to get the BasicManager (Hack for password implementation)
BasicManager* getBasicManager();
- OUString createAppLibraryFolder( SfxLibrary* pLib, const OUString& aName );
+ OUString createAppLibraryFolder( SfxLibrary* pLib, std::u16string_view aName );
void init( const OUString& rInitialDocumentURL,
const css::uno::Reference< css::embed::XStorage >& _rxInitialStorage );
- virtual const char* getInfoFileName() const = 0;
- virtual const char* getOldInfoFileName() const = 0;
- virtual const char* getLibElementFileExtension() const = 0;
- virtual const char* getLibrariesDir() const = 0;
+ virtual OUString getInfoFileName() const = 0;
+ virtual OUString getOldInfoFileName() const = 0;
+ virtual OUString getLibElementFileExtension() const = 0;
+ virtual OUString getLibrariesDir() const = 0;
// Handle maLibInfoFileURL and maStorageURL correctly
void checkStorageURL
@@ -342,6 +330,7 @@ private:
void init_Impl( const OUString& rInitialDocumentURL,
const css::uno::Reference< css::embed::XStorage >& _rxInitialStorage );
void implScanExtensions();
+ static constexpr OUString sVBATextEncodingPropName = u"VBATextEncoding"_ustr;
public:
SfxLibraryContainer();
@@ -437,6 +426,26 @@ public:
virtual void SAL_CALL removeVBAScriptListener(
const css::uno::Reference< css::script::vba::XVBAScriptListener >& Listener ) override;
virtual void SAL_CALL broadcastVBAScriptEvent( sal_Int32 nIdentifier, const OUString& rModuleName ) override;
+
+ // css::beans::XPropertySet
+ virtual css::uno::Reference<css::beans::XPropertySetInfo>
+ SAL_CALL getPropertySetInfo() override;
+ virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName,
+ const css::uno::Any& aValue) override;
+ virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName) override;
+ virtual void SAL_CALL addPropertyChangeListener(
+ const OUString& aPropertyName,
+ const css::uno::Reference<css::beans::XPropertyChangeListener>& xListener) override;
+ virtual void SAL_CALL removePropertyChangeListener(
+ const OUString& aPropertyName,
+ const css::uno::Reference<css::beans::XPropertyChangeListener>& aListener) override;
+ virtual void SAL_CALL addVetoableChangeListener(
+ const OUString& PropertyName,
+ const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) override;
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const OUString& PropertyName,
+ const css::uno::Reference<css::beans::XVetoableChangeListener>& aListener) override;
+
};
@@ -459,8 +468,7 @@ class SfxLibrary
: public css::container::XNameContainer
, public css::container::XContainer
, public css::util::XChangesNotifier
- , public ::cppu::BaseMutex
- , public ::cppu::OComponentHelper
+ , public ::comphelper::WeakComponentImplHelper<>
{
friend class SfxLibraryContainer;
friend class SfxDialogLibraryContainer;
@@ -533,15 +541,15 @@ public:
ModifiableHelper& _rModifiable,
const css::uno::Type& aType,
const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& xSFI,
- const OUString& aLibInfoFileURL,
- const OUString& aStorageURL,
+ OUString aLibInfoFileURL,
+ OUString aStorageURL,
bool ReadOnly
);
// Methods XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override;
- virtual void SAL_CALL acquire() throw() override { OComponentHelper::acquire(); }
- virtual void SAL_CALL release() throw() override { OComponentHelper::release(); }
+ virtual void SAL_CALL acquire() noexcept override { WeakComponentImplHelper::acquire(); }
+ virtual void SAL_CALL release() noexcept override { WeakComponentImplHelper::release(); }
// Methods XElementAccess
virtual css::uno::Type SAL_CALL getElementType( ) override;
@@ -655,6 +663,4 @@ private:
} // namespace basic
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx
index cb97110369f4..b9c5e692a1aa 100644
--- a/basic/source/inc/opcodes.hxx
+++ b/basic/source/inc/opcodes.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_OPCODES_HXX
-#define INCLUDED_BASIC_SOURCE_INC_OPCODES_HXX
+#pragma once
// An opcode can have a length of 1, 3 or 5 bytes,
// depending on its numeric value (see below).
@@ -154,6 +153,4 @@ enum class SbiOpcode {
SbOP2_END = FIND_STATIC_
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index 88f4f34b2b33..4e03e6d39058 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_PARSER_HXX
-#define INCLUDED_BASIC_SOURCE_INC_PARSER_HXX
+#pragma once
#include "expr.hxx"
#include "codegen.hxx"
@@ -139,6 +138,4 @@ public:
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index c00673055c8c..bb2d13d50216 100644
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -16,26 +16,28 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_PROPACC_HXX
-#define INCLUDED_BASIC_SOURCE_INC_PROPACC_HXX
+#pragma once
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <comphelper/propertysetinfo.hxx>
#include <cppuhelper/implbase.hxx>
#include <vector>
typedef std::vector<css::beans::PropertyValue> SbPropertyValueArr_Impl;
+typedef std::vector<comphelper::PropertyMapEntry> SbPropertyInfoArr_Impl;
typedef ::cppu::WeakImplHelper< css::beans::XPropertySet,
css::beans::XPropertyAccess > SbPropertyValuesHelper;
-class SbPropertyValues: public SbPropertyValuesHelper
+class SbPropertyValues final : public SbPropertyValuesHelper
{
SbPropertyValueArr_Impl m_aPropVals;
+ SbPropertyInfoArr_Impl m_aPropInfos;
css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;
private:
@@ -74,6 +76,4 @@ class SbxArray;
void RTL_Impl_CreatePropertySet( SbxArray& rPar );
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/rtlproto.hxx b/basic/source/inc/rtlproto.hxx
index 6e26f9316103..002359435749 100644
--- a/basic/source/inc/rtlproto.hxx
+++ b/basic/source/inc/rtlproto.hxx
@@ -17,13 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_RTLPROTO_HXX
-#define INCLUDED_BASIC_SOURCE_INC_RTLPROTO_HXX
+#pragma once
#include <basic/sbstar.hxx>
-#define RTLNAME( name ) &SbRtl_##name
-
typedef void( *RtlCall ) ( StarBASIC* p, SbxArray& rArgs, bool bWrite );
// Properties
@@ -75,6 +72,7 @@ extern void SbRtl_IDOK(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_IDCANCEL(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_IDABORT(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_IDRETRY(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
+extern void SbRtl_IDIGNORE(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_IDYES(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_IDNO(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
@@ -203,7 +201,6 @@ extern void SbRtl_Tan(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_UCase(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_Val(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_Len(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
-extern void SbRtl_Spc(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_DateSerial(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_TimeSerial(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_DateValue(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
@@ -235,6 +232,7 @@ extern void SbRtl_IsUnoStruct(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_FileDateTime(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_Format(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_FormatNumber(StarBASIC* pBasic, SbxArray& rPar, bool bWrite);
+extern void SbRtl_FormatPercent(StarBASIC* pBasic, SbxArray& rPar, bool bWrite);
extern void SbRtl_GetAttr(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_Randomize(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); // JSM
extern void SbRtl_Round(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
@@ -355,11 +353,10 @@ extern void SbRtl_CDateFromIso(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
extern void SbRtl_CompatibilityMode(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
extern void SbRtl_CDec(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
-extern void SbRtl_Partition(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); // Fong
+extern void SbRtl_Partition(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
+extern bool LibreOffice6FloatingPointMode();
extern double Now_Impl();
extern void Wait_Impl( bool bDurationBased, SbxArray& rPar );
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index 65be051e704f..662a7d696859 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_RUNTIME_HXX
-#define INCLUDED_BASIC_SOURCE_INC_RUNTIME_HXX
+#pragma once
#include <basic/sberrors.hxx>
#include <basic/sbmeth.hxx>
@@ -28,16 +27,19 @@
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <osl/file.hxx>
-#include <rtl/math.hxx>
#include <i18nlangtag/lang.h>
+#include <cmath>
#include <vector>
#include <memory>
+#include <optional>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
#include <unotools/localedatawrapper.hxx>
#include <o3tl/deleter.hxx>
#include <o3tl/typed_flags_set.hxx>
+#include <tools/wldcrd.hxx>
class SbiInstance; // active StarBASIC process
class SbiRuntime; // active StarBASIC procedure instance
@@ -56,6 +58,7 @@ enum class ForType {
EachArray,
EachCollection,
EachXEnumeration,
+ EachXIndexAccess,
Error,
};
@@ -75,6 +78,7 @@ struct SbiForStack { // for/next stack:
std::unique_ptr<sal_Int32[]>
pArrayUpperBounds;
css::uno::Reference< css::container::XEnumeration > xEnumeration;
+ css::uno::Reference<css::container::XIndexAccess> xIndexAccess;
SbiForStack()
: pNext(nullptr)
@@ -97,8 +101,6 @@ namespace o3tl
template<> struct typed_flags<SbAttributes> : is_typed_flags<SbAttributes, 0x13> {};
}
-class WildCard;
-
class SbiRTLData
{
public:
@@ -108,7 +110,7 @@ public:
short nCurDirPos;
OUString sFullNameToBeChecked;
- std::unique_ptr<WildCard> pWildCard;
+ std::optional<WildCard> moWildCard;
css::uno::Sequence< OUString > aDirSeq;
@@ -186,7 +188,7 @@ public:
SbiDdeControl* GetDdeControl() { return pDdeCtrl.get(); }
StarBASIC* GetBasic() { return pBasic; }
SbiDllMgr* GetDllMgr();
- SbiRTLData& GetRTLData() const { return const_cast<SbiRTLData&>(aRTLData); }
+ SbiRTLData& GetRTLData() { return aRTLData; }
std::shared_ptr<SvNumberFormatter> const & GetNumberFormatter();
sal_uInt32 GetStdDateIdx() const { return nStdDateIdx; }
@@ -209,9 +211,9 @@ class SbiRuntime
typedef void( SbiRuntime::*pStep0 )();
typedef void( SbiRuntime::*pStep1 )( sal_uInt32 nOp1 );
typedef void( SbiRuntime::*pStep2 )( sal_uInt32 nOp1, sal_uInt32 nOp2 );
- static pStep0 aStep0[]; // opcode-table group 0
- static pStep1 aStep1[];
- static pStep2 aStep2[];
+ static const pStep0 aStep0[]; // opcode-table group 0
+ static const pStep1 aStep1[];
+ static const pStep2 aStep2[];
StarBASIC& rBasic; // StarBASIC instance
SbiInstance* pInst; // current thread
@@ -224,31 +226,30 @@ class SbiRuntime
SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
SbxVariableRef refRedim; // Array saved to use for REDIM
SbxVariableRef xDummyVar; // substitute for variables that weren't found
- SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
- SbiForStack* pForStk; // FOR/NEXT-Stack
- sal_uInt16 nExprLvl; // depth of the expr-stack
- sal_uInt16 nForLvl; // #118235: Maintain for level
+ SbxVariable* mpExtCaller = nullptr; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
+ SbiForStack* pForStk = nullptr; // FOR/NEXT-Stack
+ sal_uInt16 nExprLvl = 0; // depth of the expr-stack
+ sal_uInt16 nForLvl = 0; // #118235: Maintain for level
const sal_uInt8* pCode; // current Code-Pointer
const sal_uInt8* pStmnt; // beginning of the last statement
- const sal_uInt8* pError; // address of the current error handler
- const sal_uInt8* pRestart; // restart-address
- const sal_uInt8* pErrCode; // restart-address RESUME NEXT
- const sal_uInt8* pErrStmnt; // restart-address RESUME 0
+ const sal_uInt8* pError = nullptr; // address of the current error handler
+ const sal_uInt8* pRestart = nullptr; // restart-address
+ const sal_uInt8* pErrCode = nullptr; // restart-address RESUME NEXT
+ const sal_uInt8* pErrStmnt = nullptr; // restart-address RESUME 0
OUString aLibName; // Lib-name for declare-call
SbxArrayRef refParams; // current procedure parameters
SbxArrayRef refLocals; // local variable
SbxArrayRef refArgv;
// #74254, one refSaveObj is not enough! new: pRefSaveList (see above)
- short nArgc;
- bool bRun;
- bool bError; // true: handle errors
- bool bInError; // true: in an error handler
- bool bBlocked; // true: blocked by next call level, #i48868
+ short nArgc = 0;
+ bool bRun = true;
+ bool bError = true; // true: handle errors
+ bool bInError = false; // true: in an error handler
+ bool bBlocked = false; // true: blocked by next call level, #i48868
bool bVBAEnabled;
BasicDebugFlags nFlags; // Debugging-Flags
- ErrCode nError;
- sal_uInt16 nOps; // opcode counter
- sal_uInt32 m_nLastTime;
+ ErrCode nError = ERRCODE_NONE;
+ sal_uInt16 nOps = 0; // opcode counter
std::vector<SbxVariableRef> aRefSaved; // #74254 save temporary references
std::vector<SbiGosub> pGosubStk; // GOSUB stack
@@ -285,10 +286,11 @@ class SbiRuntime
void SetParameters( SbxArray* );
// HAS TO BE IMPLEMENTED SOME TIME
- void DllCall( const OUString&, const OUString&, SbxArray*, SbxDataType, bool );
+ void DllCall( std::u16string_view, std::u16string_view, SbxArray*, SbxDataType, bool );
// #56204 swap out DIM-functionality into help method (step0.cxx)
void DimImpl(const SbxVariableRef& refVar);
+ bool EvaluateTopOfStackAsBool();
static bool implIsClass( SbxObject const * pObj, const OUString& aClass );
@@ -346,8 +348,8 @@ public:
void SetVBAEnabled( bool bEnabled );
bool IsImageFlag( SbiImageFlags n ) const;
sal_uInt16 GetBase() const;
- sal_Int32 nLine,nCol1,nCol2;
- SbiRuntime* pNext; // Stack-Chain
+ sal_Int32 nLine = 0, nCol1 = 0, nCol2 = 0;
+ SbiRuntime* pNext = nullptr; // Stack-Chain
// tdf#79426, tdf#125180 - adds the information about a missing parameter
static void SetIsMissing( SbxVariable* );
@@ -416,6 +418,4 @@ bool IsBaseIndexOne();
void removeDimAsNewRecoverItem( SbxVariable* pVar );
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index 75e3ede9a6bb..ae18e0f9e30b 100644
--- a/basic/source/inc/sbintern.hxx
+++ b/basic/source/inc/sbintern.hxx
@@ -17,14 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_SBINTERN_HXX
-#define INCLUDED_BASIC_SOURCE_INC_SBINTERN_HXX
+#pragma once
-#include <basic/basicdllapi.h>
#include <basic/sbstar.hxx>
#include <sbxfac.hxx>
+#include "sbunoobj.hxx"
#include <unotools/transliterationwrapper.hxx>
-#include <vcl/errcode.hxx>
+#include <comphelper/errcode.hxx>
+#include <config_features.h>
+#include <optional>
namespace utl
{
@@ -38,11 +39,11 @@ class SbiInstance;
class SbModule;
class BasicManager;
-class SbiFactory : public SbxFactory
+class SbiFactory final : public SbxFactory
{
public:
- virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
- virtual SbxObject* CreateObject( const OUString& ) override;
+ virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
+ virtual SbxObjectRef CreateObject( const OUString& ) override;
};
struct SbClassData
@@ -61,7 +62,7 @@ struct SbClassData
// #115824: Factory class to create class objects (type command)
// Implementation: sb.cxx
-class SbClassFactory : public SbxFactory
+class SbClassFactory final : public SbxFactory
{
SbxObjectRef xClassModules;
@@ -72,28 +73,58 @@ public:
void AddClassModule( SbModule* pClassModule );
void RemoveClassModule( SbModule* pClassModule );
- virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
- virtual SbxObject* CreateObject( const OUString& ) override;
+ virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
+ virtual SbxObjectRef CreateObject( const OUString& ) override;
SbModule* FindClass( const OUString& rClassName );
};
+// Factory class to create user defined objects (type command)
+class SbTypeFactory final : public SbxFactory
+{
+public:
+ virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
+ virtual SbxObjectRef CreateObject( const OUString& ) override;
+};
+
+class SbFormFactory final : public SbxFactory
+{
+public:
+ virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
+ virtual SbxObjectRef CreateObject( const OUString& ) override;
+};
+
+// Factory class to create OLE objects
+class SbOLEFactory final : public SbxFactory
+{
+public:
+ virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
+ virtual SbxObjectRef CreateObject( const OUString& ) override;
+};
+
struct SbiGlobals
{
static SbiGlobals* pGlobals;
SbiInstance* pInst; // all active runtime instances
- std::unique_ptr<SbiFactory> pSbFac; // StarBASIC-Factory
- std::unique_ptr<SbUnoFactory> pUnoFac; // Factory for Uno-Structs at DIM AS NEW
- SbTypeFactory* pTypeFac; // Factory for user defined types
- SbClassFactory* pClassFac; // Factory for user defined classes (based on class modules)
- SbOLEFactory* pOLEFac; // Factory for OLE types
- SbFormFactory* pFormFac; // Factory for user forms
+#if HAVE_FEATURE_SCRIPTING
+ std::optional<SbiFactory> pSbFac; // StarBASIC-Factory
+ std::optional<SbUnoFactory> pUnoFac; // Factory for Uno-Structs at DIM AS NEW
+ std::optional<SbTypeFactory>
+ pTypeFac; // Factory for user defined types
+ std::unique_ptr<SbClassFactory>
+ pClassFac; // Factory for user defined classes (based on class modules)
+ std::optional<SbOLEFactory>
+ pOLEFac; // Factory for OLE types
+ std::optional<SbFormFactory>
+ pFormFac; // Factory for user forms
+ std::unique_ptr<BasicManager> pAppBasMgr;
+#endif
SbModule* pMod; // currently active module
SbModule* pCompMod; // currently compiled module
short nInst; // number of BASICs
Link<StarBASIC*,bool> aErrHdl; // global error handler
Link<StarBASIC*,BasicDebugFlags> aBreakHdl; // global break handler
- ErrCode nCode;
+ ErrCodeMsg nCode;
sal_Int32 nLine;
sal_Int32 nCol1,nCol2; // from... to...
bool bCompilerError; // flag for compiler error
@@ -102,7 +133,6 @@ struct SbiGlobals
OUString aErrMsg; // buffer for GetErrorText()
std::unique_ptr<::utl::TransliterationWrapper> pTransliterationWrapper; // For StrComp
bool bBlockCompilerError;
- std::unique_ptr<BasicManager> pAppBasMgr;
StarBASIC* pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols
SbiGlobals();
@@ -113,6 +143,4 @@ struct SbiGlobals
SbiGlobals* GetSbData();
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbjsmeth.hxx b/basic/source/inc/sbjsmeth.hxx
index 2e4abc509bed..36e3842565e5 100644
--- a/basic/source/inc/sbjsmeth.hxx
+++ b/basic/source/inc/sbjsmeth.hxx
@@ -17,9 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-#ifndef INCLUDED_BASIC_SOURCE_INC_SBJSMETH_HXX
-#define INCLUDED_BASIC_SOURCE_INC_SBJSMETH_HXX
+#pragma once
#include <basic/sbmeth.hxx>
@@ -27,16 +25,13 @@
// All the basic-specific methods must be overridden virtually and must
// be deactivated. The differentiation of normal modules is done by RTTI.
-class SbJScriptMethod : public SbMethod
+class SbJScriptMethod final : public SbMethod
{
public:
- SbJScriptMethod( SbxDataType );
+ SbJScriptMethod(SbxDataType);
virtual ~SbJScriptMethod() override;
- SBX_DECL_PERSIST_NODATA(SBXID_JSCRIPTMETH,2);
+ SBX_DECL_PERSIST_NODATA(SBXID_JSCRIPTMETH, 2);
};
-
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbjsmod.hxx b/basic/source/inc/sbjsmod.hxx
index 9d2d7d8f4194..4f8584ff08e5 100644
--- a/basic/source/inc/sbjsmod.hxx
+++ b/basic/source/inc/sbjsmod.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_SBJSMOD_HXX
-#define INCLUDED_BASIC_SOURCE_INC_SBJSMOD_HXX
+#pragma once
#include <basic/sbmod.hxx>
@@ -26,16 +25,14 @@
// All the basic-specific methods must be overridden virtually and must
// be deactivated. The differentiation of normal modules is done by RTTI.
-class SbJScriptModule : public SbModule
+class SbJScriptModule final : public SbModule
{
- virtual bool LoadData( SvStream&, sal_uInt16 ) override;
- virtual bool StoreData( SvStream& ) const override;
+ virtual bool LoadData(SvStream&, sal_uInt16) override;
+ virtual std::pair<bool, sal_uInt32> StoreData(SvStream&) const override;
+
public:
- SBX_DECL_PERSIST_NODATA(SBXID_JSCRIPTMOD,1);
- SbJScriptModule(); // hand through
+ SBX_DECL_PERSIST_NODATA(SBXID_JSCRIPTMOD, 1);
+ SbJScriptModule(); // hand through
};
-#endif
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index 6827bf755d0d..4dee669219ef 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_SBUNOOBJ_HXX
-#define INCLUDED_BASIC_SOURCE_INC_SBUNOOBJ_HXX
+#pragma once
#include <basic/sbxobj.hxx>
#include <basic/sbxmeth.hxx>
@@ -32,7 +31,11 @@
#include <com/sun/star/reflection/XIdlClass.hpp>
#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
#include <rtl/ustring.hxx>
+#include <o3tl/string_view.hxx>
+
+#include <string_view>
#include <unordered_map>
+#include <utility>
#include <vector>
#include <map>
@@ -60,13 +63,13 @@ public:
void setValue( const css::uno::Any& );
};
-class SbUnoStructRefObject: public SbxObject
+class SbUnoStructRefObject final : public SbxObject
{
struct caseLessComp
{
- bool operator() (const OUString& rProp, const OUString& rOtherProp ) const
+ bool operator() (std::u16string_view rProp, std::u16string_view rOtherProp ) const
{
- return rProp.compareToIgnoreAsciiCase( rOtherProp ) < 0;
+ return o3tl::compareToIgnoreAsciiCase( rProp, rOtherProp ) < 0;
}
};
typedef std::map< OUString, std::unique_ptr<StructRefInfo>, caseLessComp > StructFieldInfo;
@@ -81,7 +84,7 @@ class SbUnoStructRefObject: public SbxObject
public:
StructRefInfo getStructMember( const OUString& rMember );
const StructRefInfo& getStructInfo() const { return maMemberInfo; }
- SbUnoStructRefObject( const OUString& aName_, const StructRefInfo& rMemberInfo );
+ SbUnoStructRefObject( const OUString& aName_, StructRefInfo aMemberInfo );
virtual ~SbUnoStructRefObject() override;
// override Find to support e. g. NameAccess
@@ -145,7 +148,7 @@ typedef tools::SvRef<SbUnoObject> SbUnoObjectRef;
void clearUnoMethods();
void clearUnoMethodsForBasic( StarBASIC const * pBasic );
-class SbUnoMethod : public SbxMethod
+class SbUnoMethod final : public SbxMethod
{
friend class SbUnoObject;
friend void clearUnoMethods();
@@ -174,7 +177,7 @@ public:
};
-class SbUnoProperty : public SbxProperty
+class SbUnoProperty final : public SbxProperty
{
friend class SbUnoObject;
friend class SbUnoStructRefObject;
@@ -191,7 +194,7 @@ class SbUnoProperty : public SbxProperty
public:
SbUnoProperty( const OUString& aName_, SbxDataType eSbxType, SbxDataType eRealSbxType,
- const css::beans::Property& aUnoProp_, sal_Int32 nId_, bool bInvocation, bool bUnoStruct );
+ css::beans::Property aUnoProp_, sal_Int32 nId_, bool bInvocation, bool bUnoStruct );
bool isUnoStruct() const { return mbUnoStruct; }
bool isInvocationBased() const
@@ -200,15 +203,15 @@ public:
};
// factory class to create uno-structs per DIM AS NEW
-class SbUnoFactory : public SbxFactory
+class SbUnoFactory final : public SbxFactory
{
public:
- virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
- virtual SbxObject* CreateObject( const OUString& ) override;
+ virtual SbxBaseRef Create( sal_uInt16 nSbxId, sal_uInt32 ) override;
+ virtual SbxObjectRef CreateObject( const OUString& ) override;
};
// wrapper for a uno-class
-class SbUnoClass : public SbxObject
+class SbUnoClass final : public SbxObject
{
const css::uno::Reference< css::reflection::XIdlClass > m_xClass;
@@ -216,9 +219,9 @@ public:
SbUnoClass( const OUString& aName_ )
: SbxObject( aName_ )
{}
- SbUnoClass( const OUString& aName_, const css::uno::Reference< css::reflection::XIdlClass >& xClass_ )
+ SbUnoClass( const OUString& aName_, css::uno::Reference< css::reflection::XIdlClass > xClass_ )
: SbxObject( aName_ )
- , m_xClass( xClass_ )
+ , m_xClass(std::move( xClass_ ))
{}
@@ -236,16 +239,16 @@ SbUnoClass* findUnoClass( const OUString& rName );
// Wrapper for UNO Service
-class SbUnoService : public SbxObject
+class SbUnoService final : public SbxObject
{
const css::uno::Reference< css::reflection::XServiceTypeDescription2 > m_xServiceTypeDesc;
bool m_bNeedsInit;
public:
SbUnoService( const OUString& aName_,
- const css::uno::Reference< css::reflection::XServiceTypeDescription2 >& xServiceTypeDesc )
+ css::uno::Reference< css::reflection::XServiceTypeDescription2 > xServiceTypeDesc )
: SbxObject( aName_ )
- , m_xServiceTypeDesc( xServiceTypeDesc )
+ , m_xServiceTypeDesc(std::move( xServiceTypeDesc ))
, m_bNeedsInit( true )
{}
@@ -257,7 +260,7 @@ public:
SbUnoService* findUnoService( const OUString& rName );
-class SbUnoServiceCtor : public SbxMethod
+class SbUnoServiceCtor final : public SbxMethod
{
friend class SbUnoService;
@@ -275,7 +278,7 @@ public:
// Wrapper for UNO Singleton
-class SbUnoSingleton : public SbxObject
+class SbUnoSingleton final : public SbxObject
{
public:
SbUnoSingleton( const OUString& aName_ );
@@ -287,14 +290,14 @@ SbUnoSingleton* findUnoSingleton( const OUString& rName );
// #105565 Special Object to wrap a strongly typed Uno Any
-class SbUnoAnyObject: public SbxObject
+class SbUnoAnyObject final : public SbxObject
{
css::uno::Any mVal;
public:
- SbUnoAnyObject( const css::uno::Any& rVal )
+ SbUnoAnyObject( css::uno::Any rVal )
: SbxObject( OUString() )
- , mVal( rVal )
+ , mVal(std::move( rVal ))
{}
const css::uno::Any& getValue() const
@@ -306,7 +309,7 @@ public:
// #112509 Special SbxArray to transport named parameters for calls
// to OLEAutomation objects through the UNO OLE automation bridge
-class AutomationNamedArgsSbxArray : public SbxArray
+class AutomationNamedArgsSbxArray final : public SbxArray
{
css::uno::Sequence< OUString > maNameSeq;
public:
@@ -338,7 +341,7 @@ void clearNativeObjectWrapperVector();
// #118116 Collection object
-class BasicCollection : public SbxObject
+class BasicCollection final : public SbxObject
{
friend class SbiRuntime;
SbxArrayRef xItemArray;
@@ -349,7 +352,7 @@ class BasicCollection : public SbxObject
virtual ~BasicCollection() override;
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
sal_Int32 implGetIndex( SbxVariable const * pIndexVar );
- sal_Int32 implGetIndexForName( const OUString& rName );
+ sal_Int32 implGetIndexForName(const OUString& rName);
void CollAdd( SbxArray* pPar_ );
void CollItem( SbxArray* pPar_ );
void CollRemove( SbxArray* pPar_ );
@@ -371,14 +374,14 @@ private:
public:
static VBAConstantHelper& instance();
SbxVariable* getVBAConstant( const OUString& rName );
- bool isVBAConstantType( const OUString& rName );
+ bool isVBAConstantType( std::u16string_view rName );
};
SbxVariable* getDefaultProp( SbxVariable* pRef );
css::uno::Reference< css::uno::XInterface > createComListener( const css::uno::Any& aControlAny,
const OUString& aVBAType,
- const OUString& aPrefix,
+ std::u16string_view aPrefix,
const SbxObjectRef& xScopeObj );
bool checkUnoObjectType(SbUnoObject& refVal, const OUString& aClass);
@@ -390,6 +393,4 @@ bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal );
void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic );
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/sbxmod.hxx b/basic/source/inc/sbxmod.hxx
index 853715c4b130..ceacaa84e191 100644
--- a/basic/source/inc/sbxmod.hxx
+++ b/basic/source/inc/sbxmod.hxx
@@ -17,14 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_SBXMOD_HXX
-#define INCLUDED_BASIC_SOURCE_INC_SBXMOD_HXX
+#pragma once
#include <com/sun/star/frame/XModel.hpp>
#include <basic/sbstar.hxx>
css::uno::Reference<css::frame::XModel> getDocumentModel(StarBASIC*);
-#endif // INCLUDED_BASIC_SOURCE_INC_SBXMOD_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx
index 9b03b0adc568..51e4ed7fa5d8 100644
--- a/basic/source/inc/scanner.hxx
+++ b/basic/source/inc/scanner.hxx
@@ -17,11 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_SCANNER_HXX
-#define INCLUDED_BASIC_SOURCE_INC_SCANNER_HXX
+#pragma once
#include <basic/sbxdef.hxx>
-#include <vcl/errcode.hxx>
+#include <comphelper/errcode.hxx>
// The scanner is stand-alone, i. e. it can be used from everywhere.
// A BASIC-instance is necessary for error messages. Without BASIC
@@ -34,6 +33,7 @@ class SbiScanner
{
OUString aBuf; // input buffer
OUString aLine;
+ OUString aSaveLine;
sal_Int32 nLineIdx;
sal_Int32 nSaveLineIdx;
StarBASIC* pBasic; // instance for error callbacks
@@ -62,25 +62,27 @@ protected:
bool bCompatible; // true: OPTION compatible
bool bVBASupportOn; // true: OPTION VBASupport 1 otherwise default False
bool bPrevLineExtentsComment; // true: Previous line is comment and ends on "... _"
+ bool bClosingUnderscore; // true: Closing underscore followed by end of line
+ bool bLineEndsWithWhitespace; // true: Line ends with whitespace (BasicCharClass::isWhitespace)
bool bInStatement;
void GenError( ErrCode );
public:
- SbiScanner( const OUString&, StarBASIC* = nullptr );
+ SbiScanner( OUString , StarBASIC* = nullptr );
void EnableErrors() { bError = false; }
bool IsHash() const { return bHash; }
bool IsCompatible() const { return bCompatible; }
void SetCompatible( bool b ) { bCompatible = b; } // #118206
bool IsVBASupportOn() const { return bVBASupportOn; }
- bool WhiteSpace() { return bSpaces; }
+ bool WhiteSpace() const { return bSpaces; }
sal_Int32 GetErrors() const { return nErrors; }
sal_Int32 GetLine() const { return nLine; }
sal_Int32 GetCol1() const { return nCol1; }
void SetCol1( sal_Int32 n ) { nCol1 = n; }
StarBASIC* GetBasic() { return pBasic; }
- void SaveLine() { nSaveLineIdx = nLineIdx; }
- void RestoreLine() { nLineIdx = nSaveLineIdx; }
+ void SaveLine() { aSaveLine = aLine; nSaveLineIdx = nLineIdx; }
+ void RestoreLine() { nLineIdx = nSaveLineIdx; aLine = aSaveLine; }
void LockColumn();
void UnlockColumn();
bool DoesColonFollow();
@@ -91,6 +93,4 @@ public:
double GetDbl() const { return nVal; }
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 98fce14b6040..2d0e8bcf3232 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_SCRIPTCONT_HXX
-#define INCLUDED_BASIC_SOURCE_INC_SCRIPTCONT_HXX
+#pragma once
#include "namecont.hxx"
#include <basic/basmgr.hxx>
@@ -30,13 +29,13 @@ namespace basic
{
-class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword
+class SfxScriptLibraryContainer final : public SfxLibraryContainer
{
css::uno::Reference< css::container::XNameAccess > mxCodeNameAccess;
// Methods to distinguish between different library types
- virtual SfxLibrary* implCreateLibrary( const OUString& aName ) override;
- virtual SfxLibrary* implCreateLibraryLink
+ virtual rtl::Reference<SfxLibrary> implCreateLibrary( const OUString& aName ) override;
+ virtual rtl::Reference<SfxLibrary> implCreateLibraryLink
( const OUString& aName, const OUString& aLibInfoFileURL,
const OUString& StorageURL, bool ReadOnly ) override;
virtual css::uno::Any createEmptyLibraryElement() override;
@@ -57,7 +56,7 @@ class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPas
virtual void importFromOldStorage( const OUString& aFile ) override;
- virtual SfxLibraryContainer* createInstanceImpl() override;
+ virtual rtl::Reference<SfxLibraryContainer> createInstanceImpl() override;
// Password encryption
@@ -76,13 +75,10 @@ class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPas
virtual void onNewRootStorage() override;
- // OldBasicPassword interface
- virtual void setLibraryPassword( const OUString& rLibraryName, const OUString& rPassword ) override;
-
- virtual const char* getInfoFileName() const override;
- virtual const char* getOldInfoFileName() const override;
- virtual const char* getLibElementFileExtension() const override;
- virtual const char* getLibrariesDir() const override;
+ virtual OUString getInfoFileName() const override;
+ virtual OUString getOldInfoFileName() const override;
+ virtual OUString getLibElementFileExtension() const override;
+ virtual OUString getLibrariesDir() const override;
public:
SfxScriptLibraryContainer();
@@ -100,6 +96,9 @@ public:
// Methods XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+
+ // Library password handling for 5.0 documents
+ void setLibraryPassword( const OUString& rLibraryName, const OUString& rPassword );
};
@@ -107,7 +106,7 @@ typedef std::unordered_map< OUString, css::script::ModuleInfo > ModuleInfoMap;
typedef ::cppu::ImplHelper1< css::script::vba::XVBAModuleInfo > SfxScriptLibrary_BASE;
-class SfxScriptLibrary : public SfxLibrary, public SfxScriptLibrary_BASE
+class SfxScriptLibrary final : public SfxLibrary, public SfxScriptLibrary_BASE
{
friend class SfxScriptLibraryContainer;
@@ -151,13 +150,11 @@ public:
static bool containsValidModule( const css::uno::Any& _rElement );
-protected:
+private:
virtual bool isLibraryElementValid(const css::uno::Any& rElement) const override;
};
} // namespace basic
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx
index d7bc4c176493..824cb90ea1a2 100644
--- a/basic/source/inc/stdobj.hxx
+++ b/basic/source/inc/stdobj.hxx
@@ -17,28 +17,27 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_STDOBJ_HXX
-#define INCLUDED_BASIC_SOURCE_INC_STDOBJ_HXX
+#pragma once
#include <basic/sbxobj.hxx>
+#include <sbstdobj.hxx>
+#include <optional>
class StarBASIC;
-class SbStdFactory;
-class SbiStdObject : public SbxObject
+class SbiStdObject final : public SbxObject
{
- std::unique_ptr<SbStdFactory> pStdFactory;
+ std::optional<SbStdFactory> pStdFactory;
virtual ~SbiStdObject() override;
using SbxVariable::GetInfo;
- static SbxInfo* GetInfo( short );
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+ static SbxInfo* GetInfo(short);
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
+
public:
- SbiStdObject( const OUString&, StarBASIC* );
- virtual SbxVariable* Find( const OUString&, SbxClassType ) override;
- virtual void SetModified( bool ) override;
+ SbiStdObject(const OUString&, StarBASIC*);
+ virtual SbxVariable* Find(const OUString&, SbxClassType) override;
+ virtual void SetModified(bool) override;
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index 2dfc9c758bda..56f68d4fe882 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_SYMTBL_HXX
-#define INCLUDED_BASIC_SOURCE_INC_SYMTBL_HXX
+#pragma once
#include <memory>
#include <vector>
@@ -108,7 +107,7 @@ protected:
sal_uInt16 nDefaultId; // Symbol number of default value
short nFixedStringLength; // String length in: Dim foo As String*Length
public:
- SbiSymDef( const OUString& );
+ SbiSymDef( OUString );
virtual ~SbiSymDef();
virtual SbiProcDef* GetProcDef();
virtual SbiConstDef* GetConstDef();
@@ -159,7 +158,7 @@ private:
};
-class SbiProcDef : public SbiSymDef { // procedure definition (from basic):
+class SbiProcDef final : public SbiSymDef { // procedure definition (from basic):
SbiSymPool aParams;
SbiSymPool aLabels; // local jump targets
OUString aLibName;
@@ -202,7 +201,7 @@ private:
};
-class SbiConstDef : public SbiSymDef
+class SbiConstDef final : public SbiSymDef
{
double nVal;
OUString aVal;
@@ -217,6 +216,4 @@ public:
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx
index 34abfce82a7f..9927e894e3b5 100644
--- a/basic/source/inc/token.hxx
+++ b/basic/source/inc/token.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_BASIC_SOURCE_INC_TOKEN_HXX
-#define INCLUDED_BASIC_SOURCE_INC_TOKEN_HXX
+#pragma once
#include "scanner.hxx"
@@ -131,10 +130,8 @@ public:
{ return t >= FIRSTKWD && t <= LASTKWD; }
static bool IsExtra( SbiToken t )
{ return t >= FIRSTEXTRA; }
- static OUString GetKeywordCase( const OUString& sKeyword );
+ static OUString GetKeywordCase( std::u16string_view sKeyword );
};
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */