summaryrefslogtreecommitdiff
path: root/basic
AgeCommit message (Collapse)Author
2023-11-18c++20: use std::erase instead of std::removed followed by erase (part 1)Julien Nabet
Change-Id: I8d038fc37a4de25bdeff2e2cc55775e3981240b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159610 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-11-10loplugin:fieldcast in ModuleSizeExceededNoel Grandin
Change-Id: I1903967d94fcd738b9e2ed8de9a19d42614a749e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159252 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-10loplugin:fieldcast in SbModuleNoel Grandin
Change-Id: I92084a1cf31832404aca43f0c8e2137a33978976 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159251 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-01tdf#156449 Preserve '0' or '?' in exponentLaurent Balland
Exponent in scientific number may use '?' as blank like in format "0.00E+?0" This change: - adds interpreatation of '0' and '?' in exponent - adds "blank-exponent-digits" attribute to scientific number for import and export to ODF - prevents using exponent with only '?'. There must be at least one '0' in exponent - adds QA test of such format and test import/export/import to ODF and OOXML - corrects one basic test Change-Id: If52edc632a161f842270bb2fd77af535e2b978d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154986 Tested-by: Jenkins Reviewed-by: Laurent Balland <laurent.balland@mailo.fr>
2023-10-23Extended loplugin:ostr: Rewrite some O[U]StringLiteral -> O[U]StringStephan Bergmann
...in include files. This is a mix of automatic rewriting in include files and manual fixups (mostly addressing loplugin:redundantfcast) in source files that include those. Change-Id: I1f3cc1e67b9cabd2e9d61a4d9e9a01e587ea35cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158337 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-19Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: basicStephan Bergmann
Change-Id: Ic82e02ff43db09174a74f4e584e2ce50e8983556 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158145 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-19Suppress some upcoming loplugin:ostr OUStringLiteral -> OUString rewritesStephan Bergmann
...which would not work, as calling constexpr SbxVariable::MakeHashCode on those vars would no longer be constant expressions Change-Id: Ib848a6405dc270a1a5b9a92084fa2d063ea37892 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158134 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-15Repurpose loplugin:stringstatic for O[U]String vars that can be constexprStephan Bergmann
...now that warning about O[U]String vars that could be O[U]StringLiteral is no longer useful Change-Id: I389e72038171f28482049b41f6224257dd11f452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157992 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-13tdf#147132 tdf#154285 Flatten and check param count of IsMissing fnAron Budea
Change-Id: I17d79dcedf2b2e1cd45ef2eb82ff5e89a9bb2b46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155028 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-10-12Make NC_ constexpr-friendlyStephan Bergmann
...by moving the char8_t -> char reinterpret_cast out of any potential constexpr paths into a new TranslateId::getId. And demonstrate constexpr'ability by making the aCategories var in OApplicationIconControl::Fill (dbaccess/source/ui/app/AppIconControl.cxx) constexpr. (And there might be more such cases that could now be made constexpr.) Change-Id: I0b4e3292faf8f6b901f9b9e934e1aa6bf0f583ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157862 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-07tdf#147132 Flatten Basic function implementationsOmkarAcharekar
Change-Id: I91ab40003011a7c537faa40daf3db85a13946c69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157669 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-10-03replace ErrorInfo with simpler mechanismNoel Grandin
Instead of returning ErrCode class everywhere, return a new class ErrrCodeMsg, which combines an ErrCode with the other parameters that are used to control the error reporting. I do not change everything that uses ErrCode here, I started from SfxBaseController/SfxMedium and worked outwards. This change serves two purposes (1) Replace the extremely whacky ErrorInfo mechanism we were using to smuggle information into the error handler reporting mechanism with a very straightforward approach of just combining it into the error class. (2) Allow us to capture the source location that produced the error, which makes debugging the source of a problem soooo much easier. Change-Id: I978b8f00c9851b41a216c7ebdef2ef94251d5519 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157440 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-20basic : remove useless allocation in BasicDLLImplArnaud Versini
Change-Id: I8e2628da08cb621087915dcfb4d55ddacfeaabc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157048 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-10using decls should come after #includeNoel Grandin
Change-Id: I058551e87bca42adede860f6f299b0f7ae2af3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156798 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-03Revert "tdf#130924 replace '*printf' with 'SAL_*' logging macros."Ilmari Lauhakangas
My mistake, did not notice https://bugs.documentfoundation.org/show_bug.cgi?id=130924#c5 We shouldn't hide test output. This reverts commit df0db4132428e95d276e923d8d5fb603dbb7f7bb. Change-Id: Ieac40effb57333322f8db8ead093a83765d17a09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156479 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-08-31tdf#130924 replace '*printf' with 'SAL_*' logging macros.sahil
Change-Id: I5bb4052ded82c355f7d71e4f38ebdefe3fcc25da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156283 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-08-25Revert "use more Reference::query instead of UNO_QUERY_THROW"Noel Grandin
This reverts commit 7fc6063914432d58d86cfcbd728d967e7c86ebfd. sberg noticed that there is a difference now: there's a subtle difference now, in that if y was null originally, it would have thrown a (caught) exception, whereas now it will crash in the y.query<X>() call. Change-Id: Idbb5a08d635d15b5ca63f4822eddf05fb0a5afa0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156002 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-18use more Reference::query instead of UNO_QUERY_THROWNoel Grandin
since querying with exceptions is consideably more expensive Change-Id: I968a9a40766b2abb0d3058549b0ed44011fd5716 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-09tdf#147132 Flatten Basic function implementationssahil
Change-Id: I0ba6e7c1e128f3216eb3b77246c659a728df1324 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155011 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2023-08-07tdf#150137 fastparser: don't crash on undeclared namespaceAron Budea
Change-Id: Icc8bbb391c7e34754b7274d67d73ff509827a3d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155381 Tested-by: Aron Budea <aron.budea@collabora.com> Reviewed-by: Aron Budea <aron.budea@collabora.com>
2023-08-04Reduce differences between _test_asserts.bas and _test_asserts.vbMike Kaganski
Change-Id: Ic546f6454f2b8581300320e1690644152d44eb83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155341 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-08-02Replace separate components list with 'gb_CppunitTest_use_rdb'Mike Kaganski
Change-Id: Iab1556d0f32707edb52c3cae7c1443a1eaf3b57b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155213 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-08-02No boost in basicMike Kaganski
Change-Id: Iba8d1bacf37d29137c2d4f4ed6f0ea1206c84f3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155186 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-07-24tdf#92620 - Adjust error message about exceeding legacy module sizeAndreas Heinisch
Adjusted the error message about exceeding legacy module size and removed the code for saving image version 11. Modules using image version 11 still can be loaded. Saving modules always result in an image version higher than image version 11 depending on the size of the module. In addition, some minor performance issues (construction of the error message and the correct list of modules) were fixed. Change-Id: I3bde9fcc1596b63446193c836fa7b5cb06eb7d97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149687 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2023-07-23nDigitPos no longer appears in expressionCaolán McNamara
so presumably we no longer need this suppression since: commit d969715fa4df9de762c652a7af27601fa75fb275 Date: Wed Jul 19 22:29:35 2023 +0200 Simplify a bit by removing a redundant condition line 627 already contains: if( nMaxDigit > nDigitPos ) Change-Id: If6ff93f91f5bd20a9a03ed828d6f4e598ff4f3da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154804 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-07-20Simplify a bit by removing a redundant conditionJulien Nabet
line 627 already contains: if( nMaxDigit > nDigitPos ) so here we know that nMaxDigit >= nDigitPos Change-Id: Ia7ed69e19a6567a5947edaa57f687bf97476a616 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154661 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-26new loplugin:constexprliteralNoel Grandin
OUStringLiteral should be declared constexpr, to enforce that it is initialised at compile-time and not runtime. This seems to make a different at least on Visual Studio Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-18Use getXWeak in basicMike Kaganski
Change-Id: I0915360548ccc02d731eb915b5d32508cedd1461 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150835 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-25merge some stringaddsNoel Grandin
found with a lightly tweaked version of the loplugin:stringadd and some hand-holding. Change-Id: I146aadcaf665e98fea89a9cad2df4dc3935622f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152275 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-09tdf#153543 - Add vba shell constantsAndreas Heinisch
Change-Id: Ifa73050f6892ce8ce95d16dedc166e68d1809491 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151567 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2023-04-14loplugin:stringviewparam improvementsNoel Grandin
improve the check by checking for methods that exclude using string_view, rather than checking for methods that __can__ use string_view, which leads to exposing some holes in our o3tl/string_view.hxx coverage. Change-Id: Ic9dd60441c671f502692f9cd2a1bb67301c4b960 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150277 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-10Drop SvStream::WriteCharPtrMike Kaganski
WriteOString is a better replacement Change-Id: Ic431b9aeb98d19fe61cff71360eee555105cc2bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150192 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-29Add an assertMike Kaganski
Change-Id: Iee190f27323202d5bb673aaba3116071f294a85b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149695 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-28tdf#142391 - Store method using 0x13 format only when actually neededAndreas Heinisch
Change-Id: I907d234b20be5e3c7bee0d44407f1bf4c4b49f05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149175 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2023-03-24loplugin:stringadd in b*Noel Grandin
after my patch to merge the bufferadd loplugin into stringadd Change-Id: Ieb9b4f5154173738e26b429b55c7a3ea38733553 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149478 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-23rtl::Static to thread-safe-staticNoel Grandin
Change-Id: Ife02e6d2be3ebfbb08522ab0183ef4aa31a99e19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149415 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-22tdf#147132: Simplify usage of StarBASIC::Error()adityasingh22
Change-Id: Iedb499fa58798d40e7193c80c31dc9337a3a356b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148519 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2023-03-22Refactor and fix VBA StrConvMike Kaganski
This properly handles null bytes that are expected when converting between byte strings and Unicode. It properly handles TransliterationFlags, which are not a bitset. In vbProperCase, it uses the correct method to lowercase the string, working not only with ASCII. Change-Id: I04e8cdca66ef9863a6516b15205a2a543ed97680 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149224 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-17tdf#151741 - BASIC Organizer: fill various URLs for librariesAndreas Heinisch
Otherwise, libraries cannot be renamed in the BASIC organizer. Change-Id: I6c78cdee12f8d6128acf68e889fca463ed782477 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148483 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2023-03-17tdf#152690: Refactor fixBaole Fang
Change-Id: I170eba4968743afbab3cc6aa943706612b3e1a57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149035 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-16tdf#152690: Fix "!" behavior when it is not the first in a groupBaole Fang
Fix "!" behavior when it is not the first in a group. Add testcases for "!" and Like. Change-Id: Ia76fa26722b6546d08dd8842d83f55bb0c0ea5ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148720 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-14elide some temporary OStringsNoel Grandin
where we can pass a string_view into OStringToOUString Change-Id: If7803ba49aa15f6e9c7bd386d32fb84003155390 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148844 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-07no need to allocate these separatelyNoel Grandin
they are all one or two words in size Change-Id: I86611e14a32dda3ae2226bbfa775ad0234513888 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148425 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-03lok: macro: VBA message dialogs was causing assertion failureMarco Cecchetti
Get VBA MsgBox and VBA Runtime Script Error dialogs to be displayed correctly without causing an assertion failure. Provided a solution that allows VBA MsgBox to be executed in a not-async way so that the VBA script is paused until the message box is closed. Change-Id: Ica7d0d343a0ea4b6a163c1c43572f18a5779a0ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147243 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147321 Tested-by: Jenkins
2023-03-02flatten some classes in basicNoel Grandin
no need to allocate separately where the contained class is only one pointer big Change-Id: If5fac0b0e20f80bffebc8611791d07888cbec1e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148089 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-26tdf#141474 tdf#151901 BASIC functions argument names do not match that of VBAAlain Romedenne
Basic function argument names can be used either by position either by name, keyword arguments ae called 'named arguments' in VBA - VBA doc: https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/understanding-named-arguments-and-optional-arguments - libO Basic function signatures: https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03090401.html?DbPAR=BASIC#bm_id3154422 This patch attempts to correct - all in one - malformed keyword names in BASIC function signatures. It reflects keyword arguments usage inside QA BASIC unit tests. In the end Online help pages may incorporate such practice. Change-Id: Iab0c92b2c152d2564662e51e68f1f736b8deefd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145720 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2023-02-24BaseMutex->std::mutex in SfxLibraryNoel Grandin
Change-Id: If059f38bb394844ba72156854eed84de51bbbfac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147654 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-24Fix build in a specific VS2022 environmentMike Kaganski
Building CppunitTest_basic_macros using VS2022 failed for me reproducibly for some time, with make[1]: *** [C:/lo/src/core/solenv/gbuild/LinkTarget.mk:841: C:/lo/src/build/workdir/LinkTarget/CppunitTest/test_basic_macros.dll] Error 139 It is caused by linking odbccp32, and legacy_stdio_definitions required by the latter with current versions of UCRT. It seems to work OK for others; but being unable to find what's different on my system, I have this workaround, using run-time loading instead. Change-Id: Ic4094398f7510bc281dfa96f980f29f12f09d7ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147626 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-02-23Extend loplugin:cppunitassertequals to more argument typesStephan Bergmann
Change-Id: Ic2990ebc2e4a9a36dcd3f90c5f634ca7dd225d52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147491 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-02-22Fix --disable-scripting build (for example for WASM)Tor Lillqvist
Was broken by ccd0ef98f76011f108f8ea1d282b96386dba0a6a. Change-Id: I37f3cf14e14ca32919d54f3d0cddbc042c2a7056 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147463 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>