diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:27:54 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:27:54 +0000 |
commit | adb203bc05e3e36173cbd46b9951f79821a81799 (patch) | |
tree | 6e6739df9b3f0a567330a0dd7ee0e03ae70876a3 /scripting/source/basprov | |
parent | Adding debian version 4:24.2.0-3. (diff) | |
download | libreoffice-adb203bc05e3e36173cbd46b9951f79821a81799.tar.xz libreoffice-adb203bc05e3e36173cbd46b9951f79821a81799.zip |
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripting/source/basprov')
-rw-r--r-- | scripting/source/basprov/basscript.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx index de50f62e11..148d1877d8 100644 --- a/scripting/source/basprov/basscript.cxx +++ b/scripting/source/basprov/basscript.cxx @@ -41,6 +41,17 @@ using namespace ::com::sun::star::document; using namespace ::com::sun::star::beans; +static void ChangeTypeKeepingValue(SbxVariable& var, SbxDataType to) +{ + SbxValues val(to); + var.Get(val); + bool bSetFlag = var.IsSet(SbxFlagBits::Fixed); + var.ResetFlag(SbxFlagBits::Fixed); + var.Put(val); + if (bSetFlag) + var.SetFlag(SbxFlagBits::Fixed); +} + namespace basprov { @@ -218,14 +229,14 @@ constexpr OUString BASSCRIPT_PROPERTY_CALLER = u"Caller"_ustr; { sal_Int32 val = xSbxVar->GetLong(); if (val >= -16777216 && val <= 16777215) - xSbxVar->SetType(t); + ChangeTypeKeepingValue(*xSbxVar, t); } else if (t == SbxDOUBLE && (a == SbxINTEGER || a == SbxLONG)) - xSbxVar->SetType(t); + ChangeTypeKeepingValue(*xSbxVar, t); else if (t == SbxLONG && a == SbxINTEGER) - xSbxVar->SetType(t); + ChangeTypeKeepingValue(*xSbxVar, t); else if (t == SbxULONG && a == SbxUSHORT) - xSbxVar->SetType(t); + ChangeTypeKeepingValue(*xSbxVar, t); // Enable passing by ref if (t != SbxVARIANT) xSbxVar->SetFlag(SbxFlagBits::Fixed); |