diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-21 14:41:58 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-08-26 04:30:03 -0500 |
commit | 37b9ea92ba81d74764a2345a9c75c65bfd272d2b (patch) | |
tree | 114a35309769e5bf7097737a9e8a5ff6e723e856 /basic/source/sbx | |
parent | 34827767b1551f7a61bcd53947255ad2d2a9e5da (diff) |
convert SBX flag bits to type-safe enum
Change-Id: I18d5d6a27f06ee60a5cb3dc393bf05b51bba4817
Reviewed-on: https://gerrit.libreoffice.org/11070
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'basic/source/sbx')
-rw-r--r-- | basic/source/sbx/sbxarray.cxx | 10 | ||||
-rw-r--r-- | basic/source/sbx/sbxbase.cxx | 16 | ||||
-rw-r--r-- | basic/source/sbx/sbxexec.cxx | 2 | ||||
-rw-r--r-- | basic/source/sbx/sbxobj.cxx | 8 | ||||
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 4 | ||||
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 6 |
6 files changed, 24 insertions, 22 deletions
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index 651ef33d95d6..eafb2d23270f 100644 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -408,7 +408,7 @@ SbxVariable* SbxArray::FindUserData( sal_uInt32 nData ) case SbxCLASS_OBJECT: { // Objects are not allowed to scan their parent. - sal_uInt16 nOld = pEntry->mpVar->GetFlags(); + SbxFlagBits nOld = pEntry->mpVar->GetFlags(); pEntry->mpVar->ResetFlag(SBX_GBLSEARCH); p = static_cast<SbxObject&>(*pEntry->mpVar).FindUserData(nData); pEntry->mpVar->SetFlags(nOld); @@ -468,7 +468,7 @@ SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t ) case SbxCLASS_OBJECT: { // Objects are not allowed to scan their parent. - sal_uInt16 nOld = pEntry->mpVar->GetFlags(); + SbxFlagBits nOld = pEntry->mpVar->GetFlags(); pEntry->mpVar->ResetFlag(SBX_GBLSEARCH); p = static_cast<SbxObject&>(*pEntry->mpVar).Find(rName, t); pEntry->mpVar->SetFlags(nOld); @@ -497,7 +497,7 @@ bool SbxArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) sal_uInt16 nElem; Clear(); bool bRes = true; - sal_uInt16 f = nFlags; + SbxFlagBits f = nFlags; nFlags |= SBX_WRITE; rStrm.ReadUInt16( nElem ); nElem &= 0x7FFF; @@ -531,14 +531,14 @@ bool SbxArray::StoreData( SvStream& rStrm ) const for( n = 0; n < mpVarEntries->size(); n++ ) { SbxVarEntry* pEntry = (*mpVarEntries)[n]; - if (pEntry->mpVar && !(pEntry->mpVar->GetFlags() & SBX_DONTSTORE)) + if (pEntry->mpVar && (pEntry->mpVar->GetFlags() & SBX_DONTSTORE) == SBX_NONE) nElem++; } rStrm.WriteUInt16( (sal_uInt16) nElem ); for( n = 0; n < mpVarEntries->size(); n++ ) { SbxVarEntry* pEntry = (*mpVarEntries)[n]; - if (pEntry->mpVar && !(pEntry->mpVar->GetFlags() & SBX_DONTSTORE)) + if (pEntry->mpVar && (pEntry->mpVar->GetFlags() & SBX_DONTSTORE) == SBX_NONE) { rStrm.WriteUInt16( (sal_uInt16) n ); if (!pEntry->mpVar->Store(rStrm)) diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index 766f5ef07beb..f7458e251571 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -200,12 +200,13 @@ SbxObject* SbxBase::CreateObject( const OUString& rClass ) SbxBase* SbxBase::Load( SvStream& rStrm ) { - sal_uInt16 nSbxId, nFlags, nVer; + sal_uInt16 nSbxId, nFlagsTmp, nVer; sal_uInt32 nCreator, nSize; - rStrm.ReadUInt32( nCreator ).ReadUInt16( nSbxId ).ReadUInt16( nFlags ).ReadUInt16( nVer ); + rStrm.ReadUInt32( nCreator ).ReadUInt16( nSbxId ).ReadUInt16( nFlagsTmp ).ReadUInt16( nVer ); + SbxFlagBits nFlags = static_cast<SbxFlagBits>(nFlagsTmp); // Correcting a foolishness of mine: - if( nFlags & SBX_RESERVED ) + if( (nFlags & SBX_RESERVED) != SBX_NONE ) nFlags = ( nFlags & ~SBX_RESERVED ) | SBX_GBLSEARCH; sal_Size nOldPos = rStrm.Tell(); @@ -256,7 +257,7 @@ void SbxBase::Skip( SvStream& rStrm ) bool SbxBase::Store( SvStream& rStrm ) { - if( !( nFlags & SBX_DONTSTORE ) ) + if( ( nFlags & SBX_DONTSTORE ) == SBX_NONE ) { rStrm.WriteUInt32( (sal_uInt32) GetCreator() ) .WriteUInt16( (sal_uInt16) GetSbxId() ) @@ -330,7 +331,7 @@ SbxObject* SbxFactory::CreateObject( const OUString& ) SbxInfo::~SbxInfo() {} -void SbxInfo::AddParam(const OUString& rName, SbxDataType eType, sal_uInt16 nFlags) +void SbxInfo::AddParam(const OUString& rName, SbxDataType eType, SbxFlagBits nFlags) { aParams.push_back(new SbxParamInfo(rName, eType, nFlags)); } @@ -354,11 +355,12 @@ bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer ) rStrm.ReadUInt32( nHelpId ).ReadUInt16( nParam ); while( nParam-- ) { - sal_uInt16 nType, nFlags; + sal_uInt16 nType, nFlagsTmp; sal_uInt32 nUserData = 0; OUString aName = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_ASCII_US); - rStrm.ReadUInt16( nType ).ReadUInt16( nFlags ); + rStrm.ReadUInt16( nType ).ReadUInt16( nFlagsTmp ); + SbxFlagBits nFlags = static_cast<SbxFlagBits>(nFlagsTmp); if( nVer > 1 ) rStrm.ReadUInt32( nUserData ); AddParam( aName, (SbxDataType) nType, nFlags ); diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx index 9d34b7f935c1..c77719326f25 100644 --- a/basic/source/sbx/sbxexec.cxx +++ b/basic/source/sbx/sbxexec.cxx @@ -288,7 +288,7 @@ static SbxVariable* Element SbxVariableRef refVar; if( !aSym.isEmpty() ) { - sal_uInt16 nOld = pObj->GetFlags(); + SbxFlagBits nOld = pObj->GetFlags(); if( pObj == pGbl ) { pObj->SetFlag( SBX_GBLSEARCH ); diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index 450562802ac1..15443694a371 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -200,10 +200,10 @@ SbxVariable* SbxObject::FindUserData( sal_uInt32 nData ) while( !pRes && pCur->pParent ) { // I myself was already searched! - sal_uInt16 nOwn = pCur->GetFlags(); + SbxFlagBits nOwn = pCur->GetFlags(); pCur->ResetFlag( SBX_EXTSEARCH ); // I search already global! - sal_uInt16 nPar = pCur->pParent->GetFlags(); + SbxFlagBits nPar = pCur->pParent->GetFlags(); pCur->pParent->ResetFlag( SBX_GBLSEARCH ); pRes = pCur->pParent->FindUserData( nData ); pCur->SetFlags( nOwn ); @@ -273,10 +273,10 @@ SbxVariable* SbxObject::Find( const OUString& rName, SbxClassType t ) while( !pRes && pCur->pParent ) { // I myself was already searched! - sal_uInt16 nOwn = pCur->GetFlags(); + SbxFlagBits nOwn = pCur->GetFlags(); pCur->ResetFlag( SBX_EXTSEARCH ); // I search already global! - sal_uInt16 nPar = pCur->pParent->GetFlags(); + SbxFlagBits nPar = pCur->pParent->GetFlags(); pCur->pParent->ResetFlag( SBX_GBLSEARCH ); pRes = pCur->pParent->Find( rName, t ); pCur->SetFlags( nOwn ); diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 1a5b8e28157a..d7e536933d0d 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -601,7 +601,7 @@ bool SbxValue::PutStringExt( const OUString& r ) // #34939: For Strings which contain a number, and if this has a Num-Type, // set a Fixed flag so that the type will not be changed - sal_uInt16 nFlags_ = GetFlags(); + SbxFlagBits nFlags_ = GetFlags(); if( ( eTargetType >= SbxINTEGER && eTargetType <= SbxCURRENCY ) || ( eTargetType >= SbxCHAR && eTargetType <= SbxUINT ) || eTargetType == SbxBOOL ) @@ -706,7 +706,7 @@ PUT( PutDecimal, SbxDECIMAL, SbxDecimal*, pDecimal ) bool SbxValue::IsFixed() const { - return ( (GetFlags() & SBX_FIXED) | (aData.eType & SbxBYREF) ) != 0; + return ((GetFlags() & SBX_FIXED) != SBX_NONE) || ((aData.eType & SbxBYREF) != 0); } // A variable is numeric, if it is EMPTY or really numeric diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 6776c0bb7f1c..89b712cd2115 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -166,7 +166,7 @@ void SbxVariable::Broadcast( sal_uIntPtr nHintId ) // Avoid further broadcasting SfxBroadcaster* pSave = pCst; pCst = NULL; - sal_uInt16 nSaveFlags = GetFlags(); + SbxFlagBits nSaveFlags = GetFlags(); SetFlag( SBX_READWRITE ); if( mpPar.Is() ) { @@ -250,7 +250,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const { aTmp += ","; } - if( i->nFlags & SBX_OPTIONAL ) + if( (i->nFlags & SBX_OPTIONAL) != SBX_NONE ) { aTmp += OUString( SbxRes( STRING_OPTIONAL ) ); } @@ -589,7 +589,7 @@ bool SbxVariable::StoreData( SvStream& rStrm ) const // #50200 Avoid that objects , which during the runtime // as return-value are saved in the method as a value were saved SbxVariable* pThis = (SbxVariable*)this; - sal_uInt16 nSaveFlags = GetFlags(); + SbxFlagBits nSaveFlags = GetFlags(); pThis->SetFlag( SBX_WRITE ); pThis->SbxValue::Clear(); pThis->SetFlags( nSaveFlags ); |