diff options
Diffstat (limited to 'basic/source/sbx/sbxarray.cxx')
-rw-r--r-- | basic/source/sbx/sbxarray.cxx | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index e1725a893fd2..9a68c1379c80 100644 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -31,7 +31,7 @@ struct SbxDim { // an array-dimension: class SbxVarEntry : public SbxVariableRef { public: - XubString* pAlias; + OUString* pAlias; SbxVarEntry() : SbxVariableRef(), pAlias( NULL ) {} ~SbxVarEntry() { delete pAlias; } }; @@ -83,11 +83,17 @@ SbxArray& SbxArray::operator=( const SbxArray& rArray ) SbxVarEntryPtr pDstRef = new SbxVarEntry; *((SbxVariableRef*) pDstRef) = *((SbxVariableRef*) pSrcRef); if( pSrcRef->pAlias ) - pDstRef->pAlias = new XubString( *pSrcRef->pAlias ); + { + pDstRef->pAlias = new OUString( *pSrcRef->pAlias ); + } if( eType != SbxVARIANT ) + { // Convert no objects if( eType != SbxOBJECT || pSrc_->GetClass() != SbxCLASS_OBJECT ) + { ((SbxVariable*) pSrc_)->Convert( eType ); + } + } pData->push_back( pDstRef ); } } @@ -247,36 +253,48 @@ void SbxArray::Put( SbxVariable* pVar, sal_uInt16 nIdx ) } } -const XubString& SbxArray::GetAlias( sal_uInt16 nIdx ) +const OUString& SbxArray::GetAlias( sal_uInt16 nIdx ) { +static const OUString sEmpty(""); + if( !CanRead() ) { SetError( SbxERR_PROP_WRITEONLY ); - return String::EmptyString(); + return sEmpty; } SbxVarEntry& rRef = (SbxVarEntry&) GetRef( nIdx ); if ( !rRef.pAlias ) - return String::EmptyString(); + { + return sEmpty; + } #ifdef DBG_UTIL else + { DBG_CHKOBJ( rRef, SbxBase, 0 ); + } #endif return *rRef.pAlias; } -void SbxArray::PutAlias( const XubString& rAlias, sal_uInt16 nIdx ) +void SbxArray::PutAlias( const OUString& rAlias, sal_uInt16 nIdx ) { if( !CanWrite() ) + { SetError( SbxERR_PROP_READONLY ); + } else { SbxVarEntry& rRef = (SbxVarEntry&) GetRef( nIdx ); if( !rRef.pAlias ) - rRef.pAlias = new XubString( rAlias ); + { + rRef.pAlias = new OUString( rAlias ); + } else + { *rRef.pAlias = rAlias; + } } } @@ -284,14 +302,20 @@ void SbxArray::Insert32( SbxVariable* pVar, sal_uInt32 nIdx ) { DBG_ASSERT( pData->size() <= SBX_MAXINDEX32, "SBX: Array wird zu gross" ); if( pData->size() > SBX_MAXINDEX32 ) + { return; + } SbxVarEntryPtr p = new SbxVarEntry; *((SbxVariableRef*) p) = pVar; SbxVarEntryPtrVector::size_type nSize = pData->size(); if( nIdx > nSize ) + { nIdx = nSize; + } if( eType != SbxVARIANT && pVar ) + { (*p)->Convert( eType ); + } if( nIdx == nSize ) { pData->push_back( p ); @@ -307,7 +331,9 @@ void SbxArray::Insert( SbxVariable* pVar, sal_uInt16 nIdx ) { DBG_ASSERT( pData->size() <= 0x3FF0, "SBX: Array wird zu gross" ); if( pData->size() > 0x3FF0 ) - return; + { + return; + } Insert32( pVar, nIdx ); } @@ -364,13 +390,13 @@ void SbxArray::Merge( SbxArray* p ) SbxVariable* pVar = *pRef1; if( pVar ) { - XubString aName = pVar->GetName(); + OUString aName = pVar->GetName(); sal_uInt16 nHash = pVar->GetHashCode(); for( sal_uInt32 j = 0; j < pData->size(); j++ ) { SbxVariableRef* pRef2 = (*pData)[j]; if( (*pRef2)->GetHashCode() == nHash - && (*pRef2)->GetName().EqualsIgnoreCaseAscii( aName ) ) + && (*pRef2)->GetName().equalsIgnoreAsciiCase( aName ) ) { *pRef2 = pVar; pRef1 = NULL; break; @@ -383,7 +409,9 @@ void SbxArray::Merge( SbxArray* p ) pData->push_back( pTemp ); *((SbxVariableRef*) pRef) = *((SbxVariableRef*) pRef1); if( pRef1->pAlias ) - pRef->pAlias = new XubString( *pRef1->pAlias ); + { + pRef->pAlias = new OUString( *pRef1->pAlias ); + } } } } @@ -441,7 +469,7 @@ SbxVariable* SbxArray::FindUserData( sal_uInt32 nData ) // Search of an element by his name and type. If an element is an object, // it will also be scanned.. -SbxVariable* SbxArray::Find( const rtl::OUString& rName, SbxClassType t ) +SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t ) { SbxVariable* p = NULL; sal_uInt32 nCount = pData->size(); @@ -459,7 +487,7 @@ SbxVariable* SbxArray::Find( const rtl::OUString& rName, SbxClassType t ) sal_uInt16 nVarHash = pVar->GetHashCode(); if( ( !nVarHash || nVarHash == nHash ) && ( t == SbxCLASS_DONTCARE || pVar->GetClass() == t ) - && ( pVar->GetName().EqualsIgnoreCaseAscii( rName ) ) ) + && ( pVar->GetName().equalsIgnoreAsciiCase( rName ) ) ) { p = pVar; p->ResetFlag( SBX_EXTFOUND ); |