summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-05-11 13:17:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-11 21:55:11 +0200
commitcde416fea13c6020805ac663e254a50b2c885abd (patch)
tree30867800e45bb5a3034be83cfebe04e06869389f /basic
parentc8e144638c10f81a25478dd8d8061d7d870b383c (diff)
in SetGlobalUNOConstant, only retrieve old value if we need it
removes some unnecessary Find() work Change-Id: I6af9c4d9a043d4361fcca1a034b2025fe7c10c28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134200 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/basmgr/basmgr.cxx19
1 files changed, 9 insertions, 10 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index fec7e5eaa496..4e01bff8cc9d 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1367,25 +1367,24 @@ bool BasicManager::GetGlobalUNOConstant( const OUString& rName, uno::Any& aOut )
return bRes;
}
-uno::Any BasicManager::SetGlobalUNOConstant( const OUString& rName, const uno::Any& _rValue )
+void BasicManager::SetGlobalUNOConstant( const OUString& rName, const uno::Any& _rValue, css::uno::Any* pOldValue )
{
- uno::Any aOldValue;
-
StarBASIC* pStandardLib = GetStdLib();
OSL_PRECOND( pStandardLib, "BasicManager::SetGlobalUNOConstant: no lib to insert into!" );
if ( !pStandardLib )
- return aOldValue;
+ return;
- // obtain the old value
- SbxVariable* pVariable = pStandardLib->Find( rName, SbxClassType::Object );
- if ( pVariable )
- aOldValue = sbxToUnoValue( pVariable );
+ if (pOldValue)
+ {
+ // obtain the old value
+ SbxVariable* pVariable = pStandardLib->Find( rName, SbxClassType::Object );
+ if ( pVariable )
+ *pOldValue = sbxToUnoValue( pVariable );
+ }
SbxObjectRef xUnoObj = GetSbUnoObject( _rValue.getValueType ().getTypeName () , _rValue );
xUnoObj->SetName(rName);
xUnoObj->SetFlag( SbxFlagBits::DontStore );
pStandardLib->Insert( xUnoObj.get() );
-
- return aOldValue;
}
bool BasicManager::LegacyPsswdBinaryLimitExceeded( std::vector< OUString >& _out_rModuleNames )