summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-10-27 12:25:40 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-10-27 11:35:18 +0100
commitdff273cc00b21b909e5f7b936d6713e9effc89cf (patch)
treecf839476df033a8c0267af6fab53ef6ff02926a8 /basic
parent94044b8981b9fd861c28c0bf2537b29a8461e0b5 (diff)
Put may succeed even if outer error is set
And use SbxValues ctor taking SbxDataType for simplicity Change-Id: I25622bae33597a8782d9451f88eadce1cf07388d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104860 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/sbx/sbxvalue.cxx30
1 files changed, 10 insertions, 20 deletions
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index fb8f8518573e..90edef4cb7e7 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -361,8 +361,7 @@ SbxValues SbxValue::Get(SbxDataType t) const
const OUString& SbxValue::GetCoreString() const
{
- SbxValues aRes;
- aRes.eType = SbxCoreSTRING;
+ SbxValues aRes(SbxCoreSTRING);
if( Get( aRes ) )
{
const_cast<SbxValue*>(this)->aToolString = *aRes.pOUString;
@@ -377,8 +376,7 @@ const OUString& SbxValue::GetCoreString() const
OUString SbxValue::GetOUString() const
{
OUString aResult;
- SbxValues aRes;
- aRes.eType = SbxSTRING;
+ SbxValues aRes(SbxSTRING);
if( Get( aRes ) )
{
aResult = *aRes.pOUString;
@@ -506,12 +504,10 @@ void SbxValue::PutStringExt( const OUString& r )
SbxDataType eTargetType = SbxDataType( aData.eType & 0x0FFF );
// tinker a Source-Value
- SbxValues aRes;
- aRes.eType = SbxSTRING;
+ SbxValues aRes(SbxSTRING);
// Only if really something was converted, take the copy,
// otherwise take the original (Unicode remains)
- bool bRet;
if( ImpConvStringExt( aStr, eTargetType ) )
aRes.pOUString = &aStr;
else
@@ -530,8 +526,7 @@ void SbxValue::PutStringExt( const OUString& r )
SetFlag( SbxFlagBits::Fixed );
}
- Put( aRes );
- bRet = bool( !IsError() );
+ const bool bRet = Put(aRes);
// If FIXED resulted in an error, set it back
// (UI-Action should not result in an error, but simply fail)
@@ -543,11 +538,9 @@ void SbxValue::PutStringExt( const OUString& r )
bool SbxValue::PutBool( bool b )
{
- SbxValues aRes;
- aRes.eType = SbxBOOL;
+ SbxValues aRes(SbxBOOL);
aRes.nUShort = sal::static_int_cast< sal_uInt16 >(b ? SbxTRUE : SbxFALSE);
- Put( aRes );
- return !IsError();
+ return Put(aRes);
}
bool SbxValue::PutEmpty()
@@ -587,17 +580,15 @@ void SbxValue::fillAutomationDecimal
bool SbxValue::PutString( const OUString& r )
{
- SbxValues aRes;
- aRes.eType = SbxSTRING;
+ SbxValues aRes(SbxSTRING);
aRes.pOUString = const_cast<OUString*>(&r);
- Put( aRes );
- return !IsError();
+ return Put(aRes);
}
#define PUT( p, e, t, m ) \
bool SbxValue::p( t n ) \
-{ SbxValues aRes(e); aRes.m = n; Put( aRes ); return !IsError(); }
+{ SbxValues aRes(e); aRes.m = n; return Put(aRes); }
void SbxValue::PutDate( double n )
{ SbxValues aRes(SbxDATE); aRes.nDouble = n; Put( aRes ); }
@@ -758,8 +749,7 @@ bool SbxValue::Convert( SbxDataType eTo )
}
// Conversion of the data:
- SbxValues aNew;
- aNew.eType = eTo;
+ SbxValues aNew(eTo);
if( Get( aNew ) )
{
// The data type could be converted. It ends here with fixed elements,