Commit Graph
5 Commits
Author SHA1 Message Date
Mike Kaganski 22d7827c66 tdf#168569: support date values in string pool
Commit f45463d8e2 (tdf#93727 Support date
literals in basic, 2017-05-24) introduced correct parsing of literals
like #2025-09-26#. However, it didn't retain the value type; there was
a discussion about that in gerrit, but no solution was found, and type
was set to double.

Later, a similar problem (storing type of value in compiled image) was
fixed in commit 5eedb3beea (tdf#142460:
properly handle boolean values in string pool, 2021-06-25).

This change reuses the same method to store date type using 'd' char in
the string pool.

Change-Id: I32e8497ece1f30980ba6d4fca248687b817348f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191555
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-09-26 23:17:10 +02:00
Mike Kaganski 92878d3216 tdf#168561: fix Str function implementation
1. If a string is passed as argument, it is returned without any changes.
For that, SbRtl_Str checks argument type, skipping processing for string.

2. Non-negative numbers are preceded by a blank space.
That already was implemented.

3. Negative numbers are preceded by a minus sign.
That was done incorrectly - a space was added for any number.

4. Dates are converted into locale-dependent strings.
That wasn't done at all - dates were converted to strings representing
the serial date. A check is implemented SbxValue::Format, to handle this.

Additionally, Format function was improved to handle such input without
format string (taking into account that it handles strings that can be
converted to numbers differently).

Change-Id: I5ac0429950e4ea8bf69b0091502b4e6dc1f4957d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191549
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2025-09-26 20:09:44 +02:00
Mike Kaganski a3597edb52 tdf#143182: fix string handling in SbxValue::Format
When a value is convertible to number, check if the format string
is for numbers of text (in SbxValue::Format). If the value is not
convertible to number, handle it according to the format string in
printfmtstr.

Change-Id: I6e11aeffd8dd8581ebc868762944e9d6d9393514
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190348
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-08-29 18:33:37 +02:00
Mike Kaganski 33434f1620 tdf#166342: refactor SbxValue::Format again, to handle date/time strings
Commit 81e1e0a2a6 changed string-to-number
procedure from SvNumberFormatter to only use SbxValue::ScanNumIntnl. But
the latter can only handle strings with simple numbers, not with dates,
times and the like.

This change restores use of SvNumberFormatter to convert input strings
to number, when SbxValue::ScanNumIntnl fails. The code is re-structured
for performance, to avoid creating SvNumberFormatter twice, and repeated
calls to GetOUString.

Change-Id: I89a4fc041fe24fe00b099ab4fbee371d1f6b5567
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185047
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-05-08 17:42:21 +02:00
Mike Kaganski 539856dbb7 Fix formatting of dates
Redression after commit 81e1e0a2a6
(Refactor SbxValue::Format, 2024-09-13).

Change-Id: Ie7eb50c32f3c1a3aec73fc882dc33cce42734747
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173449
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-09-17 05:55:13 +02:00