Commit Graph
711 Commits
Author SHA1 Message Date
Andreas Heinisch fa0a1f6462 tdf#153543 - Add vba shell constants
Change-Id: Ifa73050f6892ce8ce95d16dedc166e68d1809491
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151567
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2023-05-09 14:12:54 +02:00
Noel Grandin bc2101646b loplugin:stringviewparam improvements
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-14 07:54:28 +02:00
Mike Kaganski ccd0ef98f7 tdf#153752: SbxObject::Execute: extra characters in Option Compatible mode
Change-Id: Ib3e4bd9eb9a249123a686f2434ded7b529fb050f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147345
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-02-21 04:30:34 +00:00
Andreas Heinisch e431417aa6 Fixed a copy paste error in a comment
Change-Id: Ibcd4c2f0cccb233647f3b079f02d01f156d30138
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144818
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-12-25 19:41:05 +00:00
Noel Grandin c66f655be6 cid#1509223 Inefficient vector resizing with reserve.
Change-Id: I12f215d60a7420676523c7cec85bfa5149683841
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139083
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-31 13:13:43 +02:00
Andreas Heinisch fbce18558a tdf#149402 - BASIC: Don't extend comment if line ends in a whitespace
Change-Id: I8adf530e77a0e65329fa59ac2873b99f48befac4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135336
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-06-06 10:24:20 +02:00
Noel Grandin 5ecdedbf81 clang-tidy modernize-pass-by-value in basic
Change-Id: I9034ab95a4ccb58e36e77d911dd33cc50857c03a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135176
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-31 15:11:27 +02:00
Andreas Heinisch b94275f6d2 tdf#149157 - Break multiline continuation in a comment after a new line
Change-Id: I3dd875152a6f2cfafb67f13f597c36f01a4759b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135018
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-05-31 12:30:21 +02:00
Pragat Pandya 6abc09926c tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
Change-Id: I54257e87da0cd66da59d820c7960c3e4b020fda3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134027
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Tested-by: Jenkins
2022-05-09 20:42:03 +02:00
Noel Grandin 5200a73627 use more string_view in various
found by examining uses of OUString::copy() for likely places

Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-01 08:30:18 +02:00
Stephan Bergmann 630dc47262 -Werror,-Wunused-but-set-variable
...since 8e73111fae "CWS-TOOLING: integrate CWS
ab72"

Change-Id: Ib2fdccc36090d366ca2288b31bd1948832366c95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132210
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-28 17:50:39 +02:00
Andreas Heinisch 3ba8b56b32 tdf#147089 - Round Integral Division (IDIV) literals to Integer values
Change-Id: Ia243c6117a437d0c6efb33a4e76c5e9ee539fbdc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130302
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-02-21 23:10:46 +01:00
Gabor Kelemen 840b4eb2f3 Recheck modules [a-c]* with IWYU
See tdf#42949 for motivation

Change-Id: I74a3c3a67c3639376e2251c3eb917fa4139dfbd0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127808
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-13 08:26:15 +01:00
Noel Grandin 6299c8cae9 loplugin:constparams
Change-Id: Iebeb531fad5cc819b536788925cf8508737198b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124599
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-03 07:54:12 +01:00
Andreas Heinisch 27d96bfaea tdf#145371 - Delete array variable only before ReDim
Otherwise, global array variables don't maintain their state.

Change-Id: I10dafd9e2946630c5476c9858f765d67ef2f6d6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124368
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-10-30 18:28:17 +02:00
Andreas Heinisch 67c1591060 tdf#125637 - Correctly hand names ending with an underscore
If a name is ending with an underscore at the end of the line, it won't
be recognized correctly and it will be wrongly interpreted as the
respective name without the underscore at the end. Instead of changing
the macro source, use a flag in order to correclty identify the line end.

Change-Id: I6f933d7382b510bffed3e2692d32c232b7084624
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123833
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-10-20 20:27:59 +02:00
Arnaud Versini 0f98bcdf4d basic: simplifiy class initialization
Change-Id: I87fa2f606011aab8e34d9445d9e9299786f05747
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123324
Tested-by: Jenkins
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2021-10-17 21:25:44 +02:00
Andreas Heinisch d6063f416c tdf#131563 - Add vba color constants
Change-Id: I59bcd11b5da1450fced77671c2cf6ed44e299a06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122607
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-09-27 15:31:54 +02:00
Andrea Gelmini c42eb3d3f6 Fix typos
Change-Id: Icb9acdf67be84e3bedab53188246890b6aa82a7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120286
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-09-10 19:27:24 +02:00
Stephan Bergmann 2d64e7c4de Avoid OUString::createFromAscii on input containing NUL characters
...as it triggers the "rtl_uString_newFromLiteral - Found embedded \0 character"
SAL_WARN in rtl::str::newFromLiteral (called from OUString::createFromAscii via
rtl_uString_newFromLiteral)

Change-Id: I6013062b961657561d67d8dbbf5b2a45816eed4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121086
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-08-26 16:01:01 +02:00
Noel Grandin 4dc4065904 rtl::Static -> thread-safe static local
Change-Id: I9f8fe250813f4f376dc46c6f3d7e25e90fdbb50e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120566
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-17 22:40:40 +02:00
Noel Grandin ef38b9af0a split SvNumberFormatter into it's own header
so I can make changes without running into cyclic dependencies
between header files

Change-Id: I98a91c7cc66002ba745cdb8239e5cc267922a45c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120412
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-13 11:46:13 +02:00
Andreas Heinisch 3bcfb1aac1 tdf#143707 - Change strategy to support suffix type characters
In order to support the correct data type of numeric constants,
booleans, and default values for strings, the strategy to transport the
data type character to the runtime has been changed.

The type character will be added after the literal and the string
termination symbol in order to keep compatibility. This allows to
retrieve the correct type in StepLOADNC and in StepPARAM.

Any legacy written images are still possible to process, since if there
is a suffix type character where the data type character was directly
written after the numeric constant, it will be processed in StepLOADNC.

Without this fix, an optional parameter of type Variant, would still
include the suffixe type character, and will not be converted to the
correct type in StepPARAM.

Change-Id: I86c8192c6dc28457053fa7b23a073420e45407b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119945
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-08-10 12:23:19 +02:00
Noel Grandin bfc1600c6a loplugin:indentation improve checks for brace alignment
Change-Id: I333100fda7e181f68f36b03279b3fbb8cb768310
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117615
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-28 10:47:34 +02:00
baltasarq 5eedb3beea tdf#142460: properly handle boolean values in string pool
This makes sure that results of comparison of literals have proper boolean type,
and that this type is properly stored to/read from the string pool.

This introduces a new non-standard "type" character used in the pool: 'b'. It is
not a proper type character used in Basic (unlike '%'/'&'/'!'/'@'), but we have
to use this trick locally, because we need to pass the type that has no own type
character.

The change should be backward-compatible: older versions reading the value should
just ignore the 'b', and read the value as double.

Change-Id: Ibd4a70b366331342346eb171c8ed3c7026279596
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117655
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-06-25 16:26:50 +02:00
Joshua Williams 6cdfd89413 tdf#142180 Swapped comparison operators for static strings
It seems that, for some reason, the comparison operators for
strings in basic were swapped in the code that evaluates
string comparisons at compile-time. This is what caused
bug #142180. This commit simply swaps the operators and
should fix the bug.

Change-Id: I14f90db8598f2f7f8b709e26902986e1f64af576
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115983
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-05-23 07:14:07 +02:00
Noel Grandin 0afb2b63b3 fix some leaks in basic
Change-Id: I52c10cdbe9661974c908ee052336c779a40de402
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115323
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-10 15:14:48 +02:00
Noel Grandin b08a2b2994 use OUString::Concat here, not OUStringLiteral
Change-Id: Ia2172bcab60f32c9d9d4f6ca0230484343eef69b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114321
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-20 13:34:43 +02:00
Andreas Heinisch a9fcd2cf2b tdf#141201 - Round MOD literals to Integer values
(regression from commit I8dbfdf4bb2eceac0b5afbddd3f35e1dcde2db68b
"tdf#84435: Mod operator does not deal with decimals as described in help").

Change-Id: I74b231d3814148579a3be0a92b7602fa4387281f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113571
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-04-05 16:38:44 +02:00
John b80069e133 tdf#88442 SBasic: Don't double-initialize a Global ... As New ...
"As New" variables use lazy instantiation, but that should not re-apply each
time one re-enters the module. If the object is still there, don't replace it.

Change-Id: Ic568a56b93db9bc9139d434d97a4a4deb05840df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112018
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-03-21 21:54:11 +01:00
Mike Kaganski fbaf865ffc Drop "32" from names of SbxArray methods taking 32-bit indices
... a leftover from times when there were methods for 16-bit
as well as for 32-bit indices. 16-bit indices were removed in
commit 62f3f3d92a.

Change-Id: Idf8b1160e68e8b303cf75ea79dd7dbb3bd00275d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112187
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-03-09 13:22:18 +01:00
Noel 9430608363 simplify code, use more subView()
Change-Id: I569c7f34acbdf8451cd5c9acf1abd334637072d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110051
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-28 17:32:18 +01:00
Andreas Heinisch 0426748927 tdf#136755, tdf#124008 - delete the variable beforehand REDIM
If an array of objects is passed as an argument to ReDim, delete the
variable beforehand, otherwise the construction of the new variable
fails, because the old one is still on the stack.

Change-Id: Ic863a36f5f2aca658df369f95d275aa287edf795
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106832
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-01-25 07:57:59 +01:00
Arnaud Versini 71af8fc010 BASIC : simplify SbiSymDef and SbiSymPool initlialization
Change-Id: I5e7a34330592855aae3ec57d4b90edfa376fbacf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108370
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-28 07:27:43 +01:00
Arnaud Versini a5c1a64555 BASIC : simplify SbiExpression initialization
Change-Id: I3a1cca2f6ea3b6d3fef2e10e2ae4d0674cfe205a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108324
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-26 19:23:00 +01:00
Caolán McNamara c9eed223e2 cid#1470374 silence Stray semicolon
Change-Id: I33bc73ff0d7f94bce5c93f9c9c1b6db8f36f34df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106983
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-12-01 20:32:36 +01:00
Stephan Bergmann da212b3e09 Use sal_Int32 to print SbxLONG value
(The "%ld" format specifier had now caused -Werror,-Wformat with clang-cl for a
Windows 64-bit build.)

Change-Id: I741a3e3526a63162dbd75c018dfe7157f06819f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106575
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-25 14:05:36 +01:00
Mike Kaganski d84deb9536 Use std::vector in SbiBuffer
This removes memory management from the class; unifies the types
used throughout the code using it; and simplifies it all greatly.

Also this changes errors handling. Prevoiusly setting errors to
parser didn't handle case when no parser was passed to SbiBuffer
ctor, as BufferTransformer did, and could dereference nullptr.

Change-Id: I068eb1b3e9a616a5744fc8233781c4dd4403c84d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106452
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-24 17:11:53 +01:00
Mike Kaganski 9f791ae23a Simplify SbiBuffer::Check
Change-Id: Ic90d8ee858d25bed36c89f95d5de94440cb48f1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106399
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-23 15:11:12 +01:00
Arnaud Versini 1fdd1e8f2e BASIC : use initialization list in constructors.
Change-Id: I651a16be0a80210504267a743b2c50474fb1cc50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106357
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-22 17:53:04 +01:00
Arnaud Versini 8ad514c665 BASIC : use std::make_unique instead of std::unique_ptr ( new ... )
Change-Id: Ic907f4711685539b6a89411e704845617cc5f04d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105375
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-05 20:39:26 +01:00
Gabor Kelemen 0505a00a9b tdf#42949 Fix new IWYU warnings in directories [ab]*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: Ib0008b9bb095f27e5e436d6b507dc709ab7bf01a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105313
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-05 14:57:25 +01:00
Noel 387a88fa25 use tools::Long in basegfx..chart2
Change-Id: Ide4014348d51f0b5f59e1e91b8d41c7748853254
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104608
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-21 15:34:16 +02:00
Arnaud Versini 1d67beea59 BASIC : useless std::unique_ptr initialisation
Change-Id: I841cbb2bad3af5f6f6212962d7f15436d5e7bead
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102105
Tested-by: Jenkins
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2020-09-06 18:27:43 +02:00
Andreas Heinisch 11292d1cc4 tdf#136032 - abort scan of a string beginning with a hashtag
Abort scan of a string beginning with a hashtag, if a comma is found. Otherwise, the compiler raises a syntax error. If
the string ends with a hashtag too, it will be parsed later checking for
a date literal.

Change-Id: I078a2302f5c65206367a00fbc584ffa7b9ede031
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102099
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-09-06 12:55:43 +02:00
Mike Kaganski 97200ca082 Use comphelper::IsContextFlagActive for flags from comphelper::NewFlagContext
Change-Id: Ib4a812dd115299d4251d863d0ee275d7acba1c5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99443
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-07-25 17:29:23 +02:00
Stephan Bergmann d902e04baf Upcoming improved loplugin:staticanonymous -> redundantstatic: basic
Change-Id: I1046ee1ea28e19afa51b0e20ee573105ced77535
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97522
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-30 19:05:48 +02:00
Stephan Bergmann da527cd45b Upcoming improved loplugin:elidestringvar: basic
Change-Id: Ie5422ac19289693c44ce81548a74bd727bb0be36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97193
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-26 11:46:49 +02:00
Stephan Bergmann f4c0c3fef7 Remove no-longer-relevant comments
...left over by 27239ad230 "basic: String ->
OUString",

>                  // Force length 1 and make char 0 afterwards
> -                String aNullCharStr( rtl::OUString(" ") );
> -                aNullCharStr.SetChar( 0, 0 );
> +                OUString aNullCharStr( (sal_Unicode)0);
>                  return aNullCharStr;

and

>      // Force length 1 and make char 0 afterwards
> -    String aNullCharStr( rtl::OUString(" ") );
> -    aNullCharStr.SetChar( 0, 0 );
> +    OUString aNullCharStr((sal_Unicode)0);
>      addStringConst( aPublics, "vbNullChar", aNullCharStr );

Change-Id: Icbf69ff7b92374b690cb5c7f0129c6a494db48f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97031
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-24 16:19:19 +02:00
Noel Grandin 5f19287a9c loplugin:simplifybool in accessibility..basic
Change-Id: Ibf6cef4baa2d3d400d953ac8bc97a66b5901def9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94972
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-28 09:05:11 +02:00