diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:27:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:27:30 +0000 |
commit | a2baea7faff31d26459dab3668a39eae85e4991b (patch) | |
tree | eaa2048ce9c715481f932dcfe20368e252b77d2f /scripting | |
parent | Adding upstream version 4:24.2.0. (diff) | |
download | libreoffice-upstream/4%24.2.1.tar.xz libreoffice-upstream/4%24.2.1.zip |
Adding upstream version 4:24.2.1.upstream/4%24.2.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripting')
-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); |