diff options
author | Arnaud Versini <arnaud.versini@gmail.com> | 2016-04-17 20:28:00 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-04-18 07:20:57 +0000 |
commit | 0fa6c88007f61176ac707cb5d77fd35cf1521123 (patch) | |
tree | b756651a9b78afe15774c28cecadadbe1875e111 | |
parent | e781dfe877ac12c214e306a89f0702c117c89197 (diff) |
BASIC : Simplify SbxArray
Change-Id: I988fcfed2b03039cbc167eaee1d09bffe42cd411
Reviewed-on: https://gerrit.libreoffice.org/24171
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | basic/source/sbx/sbxarray.cxx | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index f78c376486da..b6b80c28c55d 100644 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -124,7 +124,7 @@ SbxVariableRef& SbxArray::GetRef32( sal_uInt32 nIdx ) } while( mpVarEntries->size() <= nIdx ) { - mpVarEntries->push_back(SbxVarEntry()); + mpVarEntries->emplace_back(); } return (*mpVarEntries)[nIdx].mpVar; } @@ -141,7 +141,7 @@ SbxVariableRef& SbxArray::GetRef( sal_uInt16 nIdx ) } while( mpVarEntries->size() <= nIdx ) { - mpVarEntries->push_back(SbxVarEntry()); + mpVarEntries->emplace_back(); } return (*mpVarEntries)[nIdx].mpVar; } @@ -198,22 +198,7 @@ void SbxArray::Put32( SbxVariable* pVar, sal_uInt32 nIdx ) void SbxArray::Put( SbxVariable* pVar, sal_uInt16 nIdx ) { - if( !CanWrite() ) - SetError( ERRCODE_SBX_PROP_READONLY ); - else - { - if( pVar ) - if( eType != SbxVARIANT ) - // Convert no objects - if( eType != SbxOBJECT || pVar->GetClass() != SbxCLASS_OBJECT ) - pVar->Convert( eType ); - SbxVariableRef& rRef = GetRef( nIdx ); - if( static_cast<SbxVariable*>(rRef) != pVar ) - { - rRef = pVar; - SetFlag( SbxFlagBits::Modified ); - } - } + Put32(pVar, nIdx); } OUString SbxArray::GetAlias( sal_uInt16 nIdx ) @@ -294,11 +279,7 @@ void SbxArray::Remove32( sal_uInt32 nIdx ) void SbxArray::Remove( sal_uInt16 nIdx ) { - if( nIdx < mpVarEntries->size() ) - { - mpVarEntries->erase( mpVarEntries->begin() + nIdx ); - SetFlag( SbxFlagBits::Modified ); - } + Remove32(nIdx); } void SbxArray::Remove( SbxVariable* pVar ) |