From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- basic/inc/basic.hrc | 164 +++++++++++++++++++++++++++++++++++++++ basic/inc/global.hxx | 23 ++++++ basic/inc/pch/precompiled_sb.cxx | 12 +++ basic/inc/pch/precompiled_sb.hxx | 148 +++++++++++++++++++++++++++++++++++ basic/inc/sb.hxx | 29 +++++++ basic/inc/sbobjmod.hxx | 95 +++++++++++++++++++++++ basic/inc/sbprop.hxx | 60 ++++++++++++++ basic/inc/sbstdobj.hxx | 105 +++++++++++++++++++++++++ basic/inc/sbxbase.hxx | 59 ++++++++++++++ basic/inc/sbxfac.hxx | 33 ++++++++ basic/inc/sbxform.hxx | 154 ++++++++++++++++++++++++++++++++++++ basic/inc/sbxprop.hxx | 37 +++++++++ basic/inc/strings.hrc | 36 +++++++++ 13 files changed, 955 insertions(+) create mode 100644 basic/inc/basic.hrc create mode 100644 basic/inc/global.hxx create mode 100644 basic/inc/pch/precompiled_sb.cxx create mode 100644 basic/inc/pch/precompiled_sb.hxx create mode 100644 basic/inc/sb.hxx create mode 100644 basic/inc/sbobjmod.hxx create mode 100644 basic/inc/sbprop.hxx create mode 100644 basic/inc/sbstdobj.hxx create mode 100644 basic/inc/sbxbase.hxx create mode 100644 basic/inc/sbxfac.hxx create mode 100644 basic/inc/sbxform.hxx create mode 100644 basic/inc/sbxprop.hxx create mode 100644 basic/inc/strings.hrc (limited to 'basic/inc') diff --git a/basic/inc/basic.hrc b/basic/inc/basic.hrc new file mode 100644 index 000000000..79b940a38 --- /dev/null +++ b/basic/inc/basic.hrc @@ -0,0 +1,164 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the N_("License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include +#include +#include + +#include + +#define NC_(Context, String) TranslateId(Context, reinterpret_cast(u8##String)) + +std::pair const RID_BASIC_START[] = +{ + { NC_("RID_BASIC_START", "Syntax error."), ERRCODE_BASIC_SYNTAX }, + { NC_("RID_BASIC_START", "Return without Gosub."), ERRCODE_BASIC_NO_GOSUB }, + { NC_("RID_BASIC_START", "Incorrect entry; please retry."), ERRCODE_BASIC_REDO_FROM_START }, + { NC_("RID_BASIC_START", "Invalid procedure call."), ERRCODE_BASIC_BAD_ARGUMENT }, + { NC_("RID_BASIC_START", "Overflow."), ERRCODE_BASIC_MATH_OVERFLOW }, + { NC_("RID_BASIC_START", "Not enough memory."), ERRCODE_BASIC_NO_MEMORY }, + { NC_("RID_BASIC_START", "Array already dimensioned."), ERRCODE_BASIC_ALREADY_DIM }, + { NC_("RID_BASIC_START", "Index out of defined range."), ERRCODE_BASIC_OUT_OF_RANGE }, + { NC_("RID_BASIC_START", "Duplicate definition."), ERRCODE_BASIC_DUPLICATE_DEF }, + { NC_("RID_BASIC_START", "Division by zero."), ERRCODE_BASIC_ZERODIV }, + { NC_("RID_BASIC_START", "Variable not defined."), ERRCODE_BASIC_VAR_UNDEFINED }, + { NC_("RID_BASIC_START", "Data type mismatch."), ERRCODE_BASIC_CONVERSION }, + { NC_("RID_BASIC_START", "Invalid parameter."), ERRCODE_BASIC_BAD_PARAMETER }, + { NC_("RID_BASIC_START", "Process interrupted by user."), ERRCODE_BASIC_USER_ABORT }, + { NC_("RID_BASIC_START", "Resume without error."), ERRCODE_BASIC_BAD_RESUME }, + { NC_("RID_BASIC_START", "Not enough stack memory."), ERRCODE_BASIC_STACK_OVERFLOW }, + { NC_("RID_BASIC_START", "Sub-procedure or function procedure not defined."), ERRCODE_BASIC_PROC_UNDEFINED }, + { NC_("RID_BASIC_START", "Error loading DLL file."), ERRCODE_BASIC_BAD_DLL_LOAD }, + { NC_("RID_BASIC_START", "Wrong DLL call convention."), ERRCODE_BASIC_BAD_DLL_CALL }, + { NC_("RID_BASIC_START", "Internal error $(ARG1)."), ERRCODE_BASIC_INTERNAL_ERROR }, + { NC_("RID_BASIC_START", "Invalid file name or file number."), ERRCODE_BASIC_BAD_CHANNEL }, + { NC_("RID_BASIC_START", "File not found."), ERRCODE_BASIC_FILE_NOT_FOUND }, + { NC_("RID_BASIC_START", "Incorrect file mode."), ERRCODE_BASIC_BAD_FILE_MODE }, + { NC_("RID_BASIC_START", "File already open."), ERRCODE_BASIC_FILE_ALREADY_OPEN }, + { NC_("RID_BASIC_START", "Device I/O error."), ERRCODE_BASIC_IO_ERROR }, + { NC_("RID_BASIC_START", "File already exists."), ERRCODE_BASIC_FILE_EXISTS }, + { NC_("RID_BASIC_START", "Incorrect record length."), ERRCODE_BASIC_BAD_RECORD_LENGTH }, + { NC_("RID_BASIC_START", "Disk or hard drive full."), ERRCODE_BASIC_DISK_FULL }, + { NC_("RID_BASIC_START", "Reading exceeds EOF."), ERRCODE_BASIC_READ_PAST_EOF }, + { NC_("RID_BASIC_START", "Incorrect record number."), ERRCODE_BASIC_BAD_RECORD_NUMBER }, + { NC_("RID_BASIC_START", "Too many files."), ERRCODE_BASIC_TOO_MANY_FILES }, + { NC_("RID_BASIC_START", "Device not available."), ERRCODE_BASIC_NO_DEVICE }, + { NC_("RID_BASIC_START", "Access denied."), ERRCODE_BASIC_ACCESS_DENIED }, + { NC_("RID_BASIC_START", "Disk not ready."), ERRCODE_BASIC_NOT_READY }, + { NC_("RID_BASIC_START", "Not implemented."), ERRCODE_BASIC_NOT_IMPLEMENTED }, + { NC_("RID_BASIC_START", "Renaming on different drives impossible."), ERRCODE_BASIC_DIFFERENT_DRIVE }, + { NC_("RID_BASIC_START", "Path/File access error."), ERRCODE_BASIC_ACCESS_ERROR }, + { NC_("RID_BASIC_START", "Path not found."), ERRCODE_BASIC_PATH_NOT_FOUND }, + { NC_("RID_BASIC_START", "Object variable not set."), ERRCODE_BASIC_NO_OBJECT }, + { NC_("RID_BASIC_START", "Invalid string pattern."), ERRCODE_BASIC_BAD_PATTERN }, + { NC_("RID_BASIC_START", "Use of zero not permitted."), ERRCODE_BASIC_IS_NULL }, + { NC_("RID_BASIC_START", "DDE Error."), ERRCODE_BASIC_DDE_ERROR }, + { NC_("RID_BASIC_START", "Awaiting response to DDE connection."), ERRCODE_BASIC_DDE_WAITINGACK }, + { NC_("RID_BASIC_START", "No DDE channels available."), ERRCODE_BASIC_DDE_OUTOFCHANNELS }, + { NC_("RID_BASIC_START", "No application responded to DDE connect initiation."), ERRCODE_BASIC_DDE_NO_RESPONSE }, + { NC_("RID_BASIC_START", "Too many applications responded to DDE connect initiation."), ERRCODE_BASIC_DDE_MULT_RESPONSES }, + { NC_("RID_BASIC_START", "DDE channel locked."), ERRCODE_BASIC_DDE_CHANNEL_LOCKED }, + { NC_("RID_BASIC_START", "External application cannot execute DDE operation."), ERRCODE_BASIC_DDE_NOTPROCESSED }, + { NC_("RID_BASIC_START", "Timeout while waiting for DDE response."), ERRCODE_BASIC_DDE_TIMEOUT }, + { NC_("RID_BASIC_START", "User pressed ESCAPE during DDE operation."), ERRCODE_BASIC_DDE_USER_INTERRUPT }, + { NC_("RID_BASIC_START", "External application busy."), ERRCODE_BASIC_DDE_BUSY }, + { NC_("RID_BASIC_START", "DDE operation without data."), ERRCODE_BASIC_DDE_NO_DATA }, + { NC_("RID_BASIC_START", "Data are in wrong format."), ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT }, + { NC_("RID_BASIC_START", "External application has been terminated."), ERRCODE_BASIC_DDE_PARTNER_QUIT }, + { NC_("RID_BASIC_START", "DDE connection interrupted or modified."), ERRCODE_BASIC_DDE_CONV_CLOSED }, + { NC_("RID_BASIC_START", "DDE method invoked with no channel open."), ERRCODE_BASIC_DDE_NO_CHANNEL }, + { NC_("RID_BASIC_START", "Invalid DDE link format."), ERRCODE_BASIC_DDE_INVALID_LINK }, + { NC_("RID_BASIC_START", "DDE message has been lost."), ERRCODE_BASIC_DDE_QUEUE_OVERFLOW }, + { NC_("RID_BASIC_START", "Paste link already performed."), ERRCODE_BASIC_DDE_LINK_ALREADY_EST }, + { NC_("RID_BASIC_START", "Link mode cannot be set due to invalid link topic."), ERRCODE_BASIC_DDE_LINK_INV_TOPIC }, + { NC_("RID_BASIC_START", "DDE requires the DDEML.DLL file."), ERRCODE_BASIC_DDE_DLL_NOT_FOUND }, + { NC_("RID_BASIC_START", "Module cannot be loaded; invalid format."), ERRCODE_BASIC_CANNOT_LOAD }, + { NC_("RID_BASIC_START", "Invalid object index."), ERRCODE_BASIC_BAD_INDEX }, + { NC_("RID_BASIC_START", "Object is not available."), ERRCODE_BASIC_NO_ACTIVE_OBJECT }, + { NC_("RID_BASIC_START", "Incorrect property value."), ERRCODE_BASIC_BAD_PROP_VALUE }, + { NC_("RID_BASIC_START", "This property is read-only."), ERRCODE_BASIC_PROP_READONLY }, + { NC_("RID_BASIC_START", "This property is write only."), ERRCODE_BASIC_PROP_WRITEONLY }, + { NC_("RID_BASIC_START", "Invalid object reference."), ERRCODE_BASIC_INVALID_OBJECT }, + { NC_("RID_BASIC_START", "Property or method not found: $(ARG1)."), ERRCODE_BASIC_NO_METHOD }, + { NC_("RID_BASIC_START", "Object required."), ERRCODE_BASIC_NEEDS_OBJECT }, + { NC_("RID_BASIC_START", "Invalid use of an object."), ERRCODE_BASIC_INVALID_USAGE_OBJECT }, + { NC_("RID_BASIC_START", "OLE Automation is not supported by this object."), ERRCODE_BASIC_NO_OLE }, + { NC_("RID_BASIC_START", "This property or method is not supported by the object."), ERRCODE_BASIC_BAD_METHOD }, + { NC_("RID_BASIC_START", "OLE Automation Error."), ERRCODE_BASIC_OLE_ERROR }, + { NC_("RID_BASIC_START", "This action is not supported by given object."), ERRCODE_BASIC_BAD_ACTION }, + { NC_("RID_BASIC_START", "Named arguments are not supported by given object."), ERRCODE_BASIC_NO_NAMED_ARGS }, + { NC_("RID_BASIC_START", "The current locale setting is not supported by the given object."), ERRCODE_BASIC_BAD_LOCALE }, + { NC_("RID_BASIC_START", "Named argument not found."), ERRCODE_BASIC_NAMED_NOT_FOUND }, + { NC_("RID_BASIC_START", "Argument is not optional."), ERRCODE_BASIC_NOT_OPTIONAL }, + { NC_("RID_BASIC_START", "Invalid number of arguments."), ERRCODE_BASIC_WRONG_ARGS }, + { NC_("RID_BASIC_START", "Object is not a list."), ERRCODE_BASIC_NOT_A_COLL }, + { NC_("RID_BASIC_START", "Invalid ordinal number."), ERRCODE_BASIC_BAD_ORDINAL }, + { NC_("RID_BASIC_START", "Specified DLL function not found."), ERRCODE_BASIC_DLLPROC_NOT_FOUND }, + { NC_("RID_BASIC_START", "Invalid clipboard format."), ERRCODE_BASIC_BAD_CLIPBD_FORMAT }, + { NC_("RID_BASIC_START", "Object does not have this property."), ERRCODE_BASIC_PROPERTY_NOT_FOUND }, + { NC_("RID_BASIC_START", "Object does not have this method."), ERRCODE_BASIC_METHOD_NOT_FOUND }, + { NC_("RID_BASIC_START", "Required argument lacking."), ERRCODE_BASIC_ARG_MISSING }, + { NC_("RID_BASIC_START", "Invalid number of arguments."), ERRCODE_BASIC_BAD_NUMBER_OF_ARGS }, + { NC_("RID_BASIC_START", "Error executing a method."), ERRCODE_BASIC_METHOD_FAILED }, + { NC_("RID_BASIC_START", "Unable to set property."), ERRCODE_BASIC_SETPROP_FAILED }, + { NC_("RID_BASIC_START", "Unable to determine property."), ERRCODE_BASIC_GETPROP_FAILED }, + // Compiler errors. These are not runtime errors. + { NC_("RID_BASIC_START", "Unexpected symbol: $(ARG1)."), ERRCODE_BASIC_UNEXPECTED }, + { NC_("RID_BASIC_START", "Expected: $(ARG1)."), ERRCODE_BASIC_EXPECTED }, + { NC_("RID_BASIC_START", "Symbol expected."), ERRCODE_BASIC_SYMBOL_EXPECTED }, + { NC_("RID_BASIC_START", "Variable expected."), ERRCODE_BASIC_VAR_EXPECTED }, + { NC_("RID_BASIC_START", "Label expected."), ERRCODE_BASIC_LABEL_EXPECTED }, + { NC_("RID_BASIC_START", "Value cannot be applied."), ERRCODE_BASIC_LVALUE_EXPECTED }, + { NC_("RID_BASIC_START", "Variable $(ARG1) already defined."), ERRCODE_BASIC_VAR_DEFINED }, + { NC_("RID_BASIC_START", "Sub procedure or function procedure $(ARG1) already defined."), ERRCODE_BASIC_PROC_DEFINED }, + { NC_("RID_BASIC_START", "Label $(ARG1) already defined."), ERRCODE_BASIC_LABEL_DEFINED }, + { NC_("RID_BASIC_START", "Variable $(ARG1) not found."), ERRCODE_BASIC_UNDEF_VAR }, + { NC_("RID_BASIC_START", "Array or procedure $(ARG1) not found."), ERRCODE_BASIC_UNDEF_ARRAY }, + { NC_("RID_BASIC_START", "Procedure $(ARG1) not found."), ERRCODE_BASIC_UNDEF_PROC }, + { NC_("RID_BASIC_START", "Label $(ARG1) undefined."), ERRCODE_BASIC_UNDEF_LABEL }, + { NC_("RID_BASIC_START", "Unknown data type $(ARG1)."), ERRCODE_BASIC_UNDEF_TYPE }, + { NC_("RID_BASIC_START", "Exit $(ARG1) expected."), ERRCODE_BASIC_BAD_EXIT }, + { NC_("RID_BASIC_START", "Statement block still open: $(ARG1) missing."), ERRCODE_BASIC_BAD_BLOCK }, + { NC_("RID_BASIC_START", "Parentheses do not match."), ERRCODE_BASIC_BAD_BRACKETS }, + { NC_("RID_BASIC_START", "Symbol $(ARG1) already defined differently."), ERRCODE_BASIC_BAD_DECLARATION }, + { NC_("RID_BASIC_START", "Parameters do not correspond to procedure."), ERRCODE_BASIC_BAD_PARAMETERS }, + { NC_("RID_BASIC_START", "Invalid character in number."), ERRCODE_BASIC_BAD_CHAR_IN_NUMBER }, + { NC_("RID_BASIC_START", "Array must be dimensioned."), ERRCODE_BASIC_MUST_HAVE_DIMS }, + { NC_("RID_BASIC_START", "Else/Endif without If."), ERRCODE_BASIC_NO_IF }, + { NC_("RID_BASIC_START", "$(ARG1) not allowed within a procedure."), ERRCODE_BASIC_NOT_IN_SUBR }, + { NC_("RID_BASIC_START", "$(ARG1) not allowed outside a procedure."), ERRCODE_BASIC_NOT_IN_MAIN }, + { NC_("RID_BASIC_START", "Dimension specifications do not match."), ERRCODE_BASIC_WRONG_DIMS }, + { NC_("RID_BASIC_START", "Unknown option: $(ARG1)."), ERRCODE_BASIC_BAD_OPTION }, + { NC_("RID_BASIC_START", "Constant $(ARG1) redefined."), ERRCODE_BASIC_CONSTANT_REDECLARED }, + { NC_("RID_BASIC_START", "Program too large."), ERRCODE_BASIC_PROG_TOO_LARGE }, + { NC_("RID_BASIC_START", "Strings or arrays not permitted."), ERRCODE_BASIC_NO_STRINGS_ARRAYS }, + { NC_("RID_BASIC_START", "An exception occurred $(ARG1)."), ERRCODE_BASIC_EXCEPTION }, + { NC_("RID_BASIC_START", "This array is fixed or temporarily locked."), ERRCODE_BASIC_ARRAY_FIX }, + { NC_("RID_BASIC_START", "Out of string space."), ERRCODE_BASIC_STRING_OVERFLOW }, + { NC_("RID_BASIC_START", "Expression Too Complex."), ERRCODE_BASIC_EXPR_TOO_COMPLEX }, + { NC_("RID_BASIC_START", "Can't perform requested operation."), ERRCODE_BASIC_OPER_NOT_PERFORM }, + { NC_("RID_BASIC_START", "Too many DLL application clients."), ERRCODE_BASIC_TOO_MANY_DLL }, + { NC_("RID_BASIC_START", "For loop not initialized."), ERRCODE_BASIC_LOOP_NOT_INIT }, + { NC_("RID_BASIC_START", "$(ARG1)"), ERRCODE_BASIC_COMPAT }, + { {}, ERRCODE_NONE } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/global.hxx b/basic/inc/global.hxx new file mode 100644 index 000000000..0f380cad3 --- /dev/null +++ b/basic/inc/global.hxx @@ -0,0 +1,23 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +namespace utl +{ +class TransliterationWrapper; +} + +class SbGlobal +{ +public: + static utl::TransliterationWrapper& GetTransliteration(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/pch/precompiled_sb.cxx b/basic/inc/pch/precompiled_sb.cxx new file mode 100644 index 000000000..5b62b93c6 --- /dev/null +++ b/basic/inc/pch/precompiled_sb.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "precompiled_sb.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/pch/precompiled_sb.hxx b/basic/inc/pch/precompiled_sb.hxx new file mode 100644 index 000000000..d327c88c5 --- /dev/null +++ b/basic/inc/pch/precompiled_sb.hxx @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + This file has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2021-09-12 11:49:52 using: + ./bin/update_pch basic sb --cutoff=2 --exclude:system --exclude:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./basic/inc/pch/precompiled_sb.hxx "make basic.build" --find-conflicts +*/ + +#include +#if PCH_LEVEL >= 1 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/sb.hxx b/basic/inc/sb.hxx new file mode 100644 index 000000000..19a591219 --- /dev/null +++ b/basic/inc/sb.hxx @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include + +// create object from user-type (+StringID+StringID) +SbxObjectRef createUserTypeImpl(const OUString& rClassName); + +SbxObjectRef cloneTypeObjectImpl(const SbxObject& rTypeObj); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/sbobjmod.hxx b/basic/inc/sbobjmod.hxx new file mode 100644 index 000000000..1a2a87cc5 --- /dev/null +++ b/basic/inc/sbobjmod.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include +#include +#include +#include +#include + +// Basic-Module for excel object. + +class SbObjModule : public SbModule +{ +protected: + virtual ~SbObjModule() override; + +public: + SbObjModule( const OUString& rName, const css::script::ModuleInfo& mInfo, bool bIsVbaCompatible ); + virtual SbxVariable* Find( const OUString& rName, SbxClassType t ) override; + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + using SbxValue::GetObject; + SbxVariable* GetObject(); + /// @throws css::uno::RuntimeException + void SetUnoObject( const css::uno::Any& aObj ) ; +}; + +class FormObjEventListenerImpl; + +class SbUserFormModule : public SbObjModule +{ + css::script::ModuleInfo m_mInfo; + ::rtl::Reference< FormObjEventListenerImpl > m_DialogListener; + css::uno::Reference m_xDialog; + css::uno::Reference m_xModel; + bool mbInit; + +//protected: + void InitObject(); +public: + SbUserFormModule( const OUString& rName, const css::script::ModuleInfo& mInfo, bool bIsVBACompat ); + virtual ~SbUserFormModule() override; + virtual SbxVariable* Find( const OUString& rName, SbxClassType t ) override; + void ResetApiObj( bool bTriggerTerminateEvent = true ); + void Unload(); + void Load(); + void triggerMethod( const OUString& ); + void triggerMethod( const OUString&, css::uno::Sequence< css::uno::Any >& ); + void triggerActivateEvent(); + void triggerDeactivateEvent(); + void triggerInitializeEvent(); + void triggerTerminateEvent(); + void triggerLayoutEvent(); + void triggerResizeEvent(); + + bool getInitState() const + { return mbInit; } + void setInitState( bool bInit ) + { mbInit = bInit; } + + class SbUserFormModuleInstance* CreateInstance(); +}; + +class SbUserFormModuleInstance final : public SbUserFormModule +{ + SbUserFormModule* m_pParentModule; + +public: + SbUserFormModuleInstance( SbUserFormModule* pParentModule, const OUString& rName, + const css::script::ModuleInfo& mInfo, bool bIsVBACompat ); + + virtual bool IsClass( const OUString& ) const override; + virtual SbxVariable* Find( const OUString& rName, SbxClassType t ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/sbprop.hxx b/basic/inc/sbprop.hxx new file mode 100644 index 000000000..8c185cc8a --- /dev/null +++ b/basic/inc/sbprop.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "sbxprop.hxx" +#include + +class SbModule; + +class SbProperty final : public SbxProperty +{ + friend class SbiFactory; + friend class SbModule; + friend class SbProcedureProperty; + SbModule* pMod; + SbProperty( const OUString&, SbxDataType, SbModule* ); + virtual ~SbProperty() override; +public: + SBX_DECL_PERSIST_NODATA(SBXID_BASICPROP,1); + SbModule* GetModule() { return pMod; } +}; + +typedef tools::SvRef SbPropertyRef; + +class SbProcedureProperty final : public SbxProperty +{ + bool mbSet; // Flag for set command + + virtual ~SbProcedureProperty() override; + +public: + SbProcedureProperty( const OUString& r, SbxDataType t ) + : SbxProperty( r, t ) // , pMod( p ) + , mbSet( false ) + {} + + bool isSet() const + { return mbSet; } + void setSet( bool bSet ) + { mbSet = bSet; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/sbstdobj.hxx b/basic/inc/sbstdobj.hxx new file mode 100644 index 000000000..69db5c9ba --- /dev/null +++ b/basic/inc/sbstdobj.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include +#include +#include "sbxfac.hxx" + +class SbStdFactory final : public SbxFactory +{ +public: + SbStdFactory(); + + virtual SbxObjectRef CreateObject( const OUString& rClassName ) override; +}; + +class SbStdPicture final : public SbxObject +{ + Graphic aGraphic; + + virtual ~SbStdPicture() override; + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + void PropType( SbxVariable* pVar, bool bWrite ); + void PropWidth( SbxVariable* pVar, bool bWrite ); + void PropHeight( SbxVariable* pVar, bool bWrite ); + +public: + + SbStdPicture(); + + const Graphic& GetGraphic() const { return aGraphic; } + void SetGraphic( const Graphic& rGrf ) { aGraphic = rGrf; } +}; + +class SbStdFont final : public SbxObject +{ + bool bBold; + bool bItalic; + bool bStrikeThrough; + bool bUnderline; + sal_uInt16 nSize; + OUString aName; + + virtual ~SbStdFont() override; + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + void PropBold( SbxVariable* pVar, bool bWrite ); + void PropItalic( SbxVariable* pVar, bool bWrite ); + void PropStrikeThrough( SbxVariable* pVar, bool bWrite ); + void PropUnderline( SbxVariable* pVar, bool bWrite ); + void PropSize( SbxVariable* pVar, bool bWrite ); + void PropName( SbxVariable* pVar, bool bWrite ); + +public: + + SbStdFont(); + + void SetBold( bool bB ) { bBold = bB; } + bool IsBold() const { return bBold; } + void SetItalic( bool bI ) { bItalic = bI; } + bool IsItalic() const { return bItalic; } + void SetStrikeThrough( bool bS ) { bStrikeThrough = bS; } + bool IsStrikeThrough() const { return bStrikeThrough; } + void SetUnderline( bool bU ) { bUnderline = bU; } + bool IsUnderline() const { return bUnderline; } + void SetSize( sal_uInt16 nS ) { nSize = nS; } + sal_uInt16 GetSize() const { return nSize; } +}; + +class SbStdClipboard final : public SbxObject +{ + virtual ~SbStdClipboard() override; + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + static void MethClear( SbxArray const * pPar_ ); + static void MethGetData( SbxArray* pPar_ ); + static void MethGetFormat( SbxVariable* pVar, SbxArray* pPar_ ); + static void MethGetText( SbxVariable* pVar, SbxArray const * pPar_ ); + static void MethSetData( SbxArray* pPar_ ); + static void MethSetText( SbxArray const * pPar_ ); + +public: + + SbStdClipboard(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/sbxbase.hxx b/basic/inc/sbxbase.hxx new file mode 100644 index 000000000..80552c2fb --- /dev/null +++ b/basic/inc/sbxbase.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include + +#include +#include +#include + +#include +#include + +class SbxFactory; +class SbxVariable; +class SbxBasicFormater; + +// AppData structure for SBX: +struct SbxAppData +{ + ErrCode eErrCode; // Error code + SbxVariableRef m_aGlobErr; // Global error object + std::vector m_Factories; // these are owned by fields in SbiGlobals + tools::SvRef mrImplRepository; + + // Pointer to Format()-Command helper class + std::unique_ptr pBasicFormater; + + LanguageType eBasicFormaterLangType; + // It might be useful to store this class 'global' because some string resources are saved here + + SbxAppData(); + SbxAppData(const SbxAppData&) = delete; + const SbxAppData& operator=(const SbxAppData&) = delete; + ~SbxAppData(); +}; + +SbxAppData& GetSbxData_Impl(); +/** returns true if the SbxAppData is still valid, used to check if we are in shutdown. */ +bool IsSbxData_Impl(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/sbxfac.hxx b/basic/inc/sbxfac.hxx new file mode 100644 index 000000000..5493a6687 --- /dev/null +++ b/basic/inc/sbxfac.hxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include +#include + +class SbxFactory +{ +public: + virtual ~SbxFactory(); + virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32); + virtual SbxObjectRef CreateObject(const OUString&); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/sbxform.hxx b/basic/inc/sbxform.hxx new file mode 100644 index 000000000..c14d950a8 --- /dev/null +++ b/basic/inc/sbxform.hxx @@ -0,0 +1,154 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +// Implementation class for Basic command: Format$( d,formatStr ) + +/* + Grammar of format string (a try): + ----------------------------------------------- + + format_string := {\special_char} general_format | scientific_format {\special_char} {;format_string} + general_format := {#[,]}{0[,]}[.{0}{#}] + scientific_format := {0}[.{0}{#}](e | E)(+ | -){#}{0} + + percent_char := '%' + special_char := \char | + | - | ( | ) | $ | space_char + char := all_ascii_chars + space_char := ' ' + + {} repeated multiple times (incl. zero times) + [] exactly one or zero times + () parenthesis, e.g. (e | E) means e or E times + + Additional predefined formats for the format string: + "General Number" + "Currency" + "Fixed" + "Standard" + "Percent" + "Scientific" + "Yes/No" + "True/False" + "On/Off" + + Note: invalid format string are ignored just as in VisualBasic, the output is + probably 'undefined'. ASCII letters are outputted directly. + + Constraints in VisualBasic: + - the exponent (scientific syntax) has a maximum of three digits! + + Constraints of new implementation: + - the '+' sign is not allowed as wildcard in the mantissa + + TODO: + - Date formatting + Wildcards are: 'h', 'm', 's', 'y' + predefined String-Constants/Commands: + "AMPM", "Long Date", "Long Time" +*/ + +#include +#include + +class SbxBasicFormater { + public: + // Constructor takes signs for decimal point, thousand separation sign + // and necessary resource strings. + SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep, + OUString _sOnStrg, + OUString _sOffStrg, + OUString _sYesStrg, + OUString _sNoStrg, + OUString _sTrueStrg, + OUString _sFalseStrg, + OUString _sCurrencyStrg, + OUString _sCurrencyFormatStrg ); + + /* Basic command: Format$( number,format-string ) + + Parameter: + dNumber : number to be formatted + sFormatStrg : the Format-String, e.g. ###0.0### + + Return value: + String containing the formatted output + */ + OUString BasicFormat( double dNumber, const OUString& sFormatStrg ); + static OUString BasicFormatNull( std::u16string_view sFormatStrg ); + + static bool isBasicFormat( std::u16string_view sFormatStrg ); + + private: + static inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos ); + static void AppendDigit( OUStringBuffer& sStrg, short nDigit ); + void LeftShiftDecimalPoint( OUStringBuffer& sStrg ); + void StrRoundDigit( OUStringBuffer& sStrg, short nPos, bool& bOverflow ); + void StrRoundDigit( OUStringBuffer& sStrg, short nPos ); + static void ParseBack( OUStringBuffer& sStrg, std::u16string_view sFormatStrg, + short nFormatPos ); + // Methods for string conversion with sprintf(): + void InitScan( double _dNum ); + void InitExp( double _dNewExp ); + short GetDigitAtPosScan( short nPos, bool& bFoundFirstDigit ); + short GetDigitAtPosExpScan( double dNewExponent, short nPos, + bool& bFoundFirstDigit ); + short GetDigitAtPosExpScan( short nPos, bool& bFoundFirstDigit ); + static OUString GetPosFormatString( std::u16string_view sFormatStrg, bool & bFound ); + static OUString GetNegFormatString( std::u16string_view sFormatStrg, bool & bFound ); + static OUString Get0FormatString( std::u16string_view sFormatStrg, bool & bFound ); + static OUString GetNullFormatString( std::u16string_view sFormatStrg, bool & bFound ); + static void AnalyseFormatString( const OUString& sFormatStrg, + short& nNoOfDigitsLeft, short& nNoOfDigitsRight, + short& nNoOfOptionalDigitsLeft, + short& nNoOfExponentDigits, + short& nNoOfOptionalExponentDigits, + bool& bPercent, bool& bCurrency, bool& bScientific, + bool& bGenerateThousandSeparator, + short& nMultipleThousandSeparators ); + void ScanFormatString( double dNumber, const OUString& sFormatStrg, + OUString& sReturnStrg, bool bCreateSign ); + + //*** Data *** + sal_Unicode cDecPoint; // sign for the decimal point + sal_Unicode cThousandSep; // sign for thousand delimiter + // Text for output: + OUString sOnStrg; + OUString sOffStrg; + OUString sYesStrg; + OUString sNoStrg; + OUString sTrueStrg; + OUString sFalseStrg; + OUString sCurrencyStrg; + OUString sCurrencyFormatStrg; + + //*** temporary data for scan loop *** + + // String containing the number in scientific format + OUString sSciNumStrg; + // String containing the exponent of the number + OUString sNumExpStrg; + double dNum; // the number that is scanned + short nNumExp; // the exponent of the number + short nExpExp; // the number of digits in the exponent +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/sbxprop.hxx b/basic/inc/sbxprop.hxx new file mode 100644 index 000000000..0c57d0b72 --- /dev/null +++ b/basic/inc/sbxprop.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include + +class SbxProperty : public SbxVariable +{ +public: + SBX_DECL_PERSIST_NODATA(SBXID_PROPERTY,1); + SbxProperty( const OUString& r, SbxDataType t ); + SbxProperty( const SbxProperty& r ) : SvRefBase( r ), SbxVariable( r ) {} + virtual ~SbxProperty() override; + SbxProperty& operator=( const SbxProperty& r ) + { SbxVariable::operator=( r ); return *this; } + virtual SbxClassType GetClass() const override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/inc/strings.hrc b/basic/inc/strings.hrc new file mode 100644 index 000000000..64b65db34 --- /dev/null +++ b/basic/inc/strings.hrc @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#define NC_(Context, String) TranslateId(Context, reinterpret_cast(u8##String)) + +#define STR_BASICKEY_FORMAT_ON NC_("STR_BASICKEY_FORMAT_ON", "On") +#define STR_BASICKEY_FORMAT_OFF NC_("STR_BASICKEY_FORMAT_OFF", "Off") +#define STR_BASICKEY_FORMAT_TRUE NC_("STR_BASICKEY_FORMAT_TRUE", "True") +#define STR_BASICKEY_FORMAT_FALSE NC_("STR_BASICKEY_FORMAT_FALSE", "False") +#define STR_BASICKEY_FORMAT_YES NC_("STR_BASICKEY_FORMAT_YES", "Yes") +#define STR_BASICKEY_FORMAT_NO NC_("STR_BASICKEY_FORMAT_NO", "No") +//format currency +#define STR_BASICKEY_FORMAT_CURRENCY NC_("STR_BASICKEY_FORMAT_CURRENCY", "@0.00 $;@(0.00 $)") + +#define IDS_SBERR_TERMINATED NC_("IDS_SBERR_TERMINATED", "The macro running has been interrupted") +#define STR_ADDITIONAL_INFO NC_("STR_ADDITIONAL_INFO", "$ERR\nAdditional information: $MSG") + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3