From f288d7dcbd65e86e2c4f6519fac91eece8f01034 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 26 Mar 2014 11:18:51 +0200 Subject: basic: sal_Bool->bool Change-Id: Id4952b6f97f9e8f917fea5651dee91499d109e48 --- basic/source/sbx/sbxarray.cxx | 41 +++++---- basic/source/sbx/sbxbase.cxx | 48 +++++----- basic/source/sbx/sbxbool.cxx | 2 +- basic/source/sbx/sbxcoll.cxx | 16 ++-- basic/source/sbx/sbxobj.cxx | 48 +++++----- basic/source/sbx/sbxscan.cxx | 7 +- basic/source/sbx/sbxvalue.cxx | 201 ++++++++++++++++++++++-------------------- basic/source/sbx/sbxvar.cxx | 34 +++---- 8 files changed, 203 insertions(+), 194 deletions(-) (limited to 'basic/source/sbx') diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index ab65a28b1a38..ece2d3c11623 100644 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -475,7 +475,7 @@ SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t ) sal_uInt32 nCount = pData->size(); if( !nCount ) return NULL; - sal_Bool bExtSearch = IsSet( SBX_EXTSEARCH ); + bool bExtSearch = IsSet( SBX_EXTSEARCH ); sal_uInt16 nHash = SbxVariable::MakeHashCode( rName ); for( sal_uInt32 i = 0; i < nCount; i++ ) { @@ -523,11 +523,11 @@ SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t ) return p; } -sal_Bool SbxArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) +bool SbxArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { sal_uInt16 nElem; Clear(); - sal_Bool bRes = sal_True; + bool bRes = true; sal_uInt16 f = nFlags; nFlags |= SBX_WRITE; rStrm.ReadUInt16( nElem ); @@ -544,7 +544,8 @@ sal_Bool SbxArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) } else { - bRes = sal_False; break; + bRes = false; + break; } } if( bRes ) @@ -553,7 +554,7 @@ sal_Bool SbxArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) return bRes; } -sal_Bool SbxArray::StoreData( SvStream& rStrm ) const +bool SbxArray::StoreData( SvStream& rStrm ) const { sal_uInt32 nElem = 0; sal_uInt32 n; @@ -574,7 +575,7 @@ sal_Bool SbxArray::StoreData( SvStream& rStrm ) const { rStrm.WriteUInt16( (sal_uInt16) n ); if( !p->Store( rStrm ) ) - return sal_False; + return false; } } return StorePrivateData( rStrm ); @@ -640,7 +641,7 @@ void SbxDimArray::Clear() // Add a dimension -void SbxDimArray::AddDimImpl32( sal_Int32 lb, sal_Int32 ub, sal_Bool bAllowSize0 ) +void SbxDimArray::AddDimImpl32( sal_Int32 lb, sal_Int32 ub, bool bAllowSize0 ) { SbxError eRes = SbxERR_OK; if( ub < lb && !bAllowSize0 ) @@ -669,51 +670,53 @@ short SbxDimArray::GetDims() const void SbxDimArray::AddDim( short lb, short ub ) { - AddDimImpl32( lb, ub, sal_False ); + AddDimImpl32( lb, ub, false ); } void SbxDimArray::unoAddDim( short lb, short ub ) { - AddDimImpl32( lb, ub, sal_True ); + AddDimImpl32( lb, ub, true ); } void SbxDimArray::AddDim32( sal_Int32 lb, sal_Int32 ub ) { - AddDimImpl32( lb, ub, sal_False ); + AddDimImpl32( lb, ub, false ); } void SbxDimArray::unoAddDim32( sal_Int32 lb, sal_Int32 ub ) { - AddDimImpl32( lb, ub, sal_True ); + AddDimImpl32( lb, ub, true ); } // Readout dimension data -sal_Bool SbxDimArray::GetDim32( sal_Int32 n, sal_Int32& rlb, sal_Int32& rub ) const +bool SbxDimArray::GetDim32( sal_Int32 n, sal_Int32& rlb, sal_Int32& rub ) const { if( n < 1 || n > nDim ) { - SetError( SbxERR_BOUNDS ); rub = rlb = 0; return sal_False; + SetError( SbxERR_BOUNDS ); + rub = rlb = 0; + return false; } SbxDim* p = pFirst; while( --n ) p = p->pNext; rub = p->nUbound; rlb = p->nLbound; - return sal_True; + return true; } -sal_Bool SbxDimArray::GetDim( short n, short& rlb, short& rub ) const +bool SbxDimArray::GetDim( short n, short& rlb, short& rub ) const { sal_Int32 rlb32, rub32; - sal_Bool bRet = GetDim32( n, rlb32, rub32 ); + bool bRet = GetDim32( n, rlb32, rub32 ); if( bRet ) { if( rlb32 < -SBX_MAXINDEX || rub32 > SBX_MAXINDEX ) { SetError( SbxERR_BOUNDS ); - return sal_False; + return false; } rub = (short)rub32; rlb = (short)rlb32; @@ -815,7 +818,7 @@ SbxVariable* SbxDimArray::Get( SbxArray* pPar ) return SbxArray::Get32( Offset32( pPar ) ); } -sal_Bool SbxDimArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) +bool SbxDimArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { short nDimension; rStrm.ReadInt16( nDimension ); @@ -828,7 +831,7 @@ sal_Bool SbxDimArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) return SbxArray::LoadData( rStrm, nVer ); } -sal_Bool SbxDimArray::StoreData( SvStream& rStrm ) const +bool SbxDimArray::StoreData( SvStream& rStrm ) const { rStrm.WriteInt16( (sal_Int16) nDim ); for( short i = 0; i < nDim; i++ ) diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index cd72554a3c0e..1d459691035f 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -94,13 +94,13 @@ void SbxBase::Clear() DBG_CHKTHIS( SbxBase, 0 ); } -sal_Bool SbxBase::IsFixed() const +bool SbxBase::IsFixed() const { DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_FIXED ); } -void SbxBase::SetModified( sal_Bool b ) +void SbxBase::SetModified( bool b ) { DBG_CHKTHIS( SbxBase, 0 ); if( IsSet( SBX_NO_MODIFY ) ) @@ -123,9 +123,9 @@ void SbxBase::SetError( SbxError e ) r.eSbxError = e; } -sal_Bool SbxBase::IsError() +bool SbxBase::IsError() { - return sal_Bool( GetSbxData_Impl().eSbxError != SbxERR_OK ); + return GetSbxData_Impl().eSbxError != SbxERR_OK; } void SbxBase::ResetError() @@ -268,7 +268,7 @@ void SbxBase::Skip( SvStream& rStrm ) rStrm.Seek( nStartPos + nSize ); } -sal_Bool SbxBase::Store( SvStream& rStrm ) +bool SbxBase::Store( SvStream& rStrm ) { DBG_CHKTHIS( SbxBase, 0 ); if( !( nFlags & SBX_DONTSTORE ) ) @@ -279,55 +279,55 @@ sal_Bool SbxBase::Store( SvStream& rStrm ) .WriteUInt16( (sal_uInt16) GetVersion() ); sal_Size nOldPos = rStrm.Tell(); rStrm.WriteUInt32( (sal_uInt32) 0L ); - sal_Bool bRes = StoreData( rStrm ); + bool bRes = StoreData( rStrm ); sal_Size nNewPos = rStrm.Tell(); rStrm.Seek( nOldPos ); rStrm.WriteUInt32( (sal_uInt32) ( nNewPos - nOldPos ) ); rStrm.Seek( nNewPos ); if( rStrm.GetError() != SVSTREAM_OK ) - bRes = sal_False; + bRes = false; if( bRes ) bRes = StoreCompleted(); return bRes; } else - return sal_True; + return true; } -sal_Bool SbxBase::LoadData( SvStream&, sal_uInt16 ) +bool SbxBase::LoadData( SvStream&, sal_uInt16 ) { DBG_CHKTHIS( SbxBase, 0 ); - return sal_False; + return false; } -sal_Bool SbxBase::StoreData( SvStream& ) const +bool SbxBase::StoreData( SvStream& ) const { DBG_CHKTHIS( SbxBase, 0 ); - return sal_False; + return false; } -sal_Bool SbxBase::LoadPrivateData( SvStream&, sal_uInt16 ) +bool SbxBase::LoadPrivateData( SvStream&, sal_uInt16 ) { DBG_CHKTHIS( SbxBase, 0 ); - return sal_True; + return true; } -sal_Bool SbxBase::StorePrivateData( SvStream& ) const +bool SbxBase::StorePrivateData( SvStream& ) const { DBG_CHKTHIS( SbxBase, 0 ); - return sal_True; + return true; } -sal_Bool SbxBase::LoadCompleted() +bool SbxBase::LoadCompleted() { DBG_CHKTHIS( SbxBase, 0 ); - return sal_True; + return true; } -sal_Bool SbxBase::StoreCompleted() +bool SbxBase::StoreCompleted() { DBG_CHKTHIS( SbxBase, 0 ); - return sal_True; + return true; } //////////////////////////////// SbxFactory @@ -364,7 +364,7 @@ const SbxParamInfo* SbxInfo::GetParam( sal_uInt16 n ) const return &(aParams[n - 1]); } -sal_Bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer ) +bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { aParams.clear(); sal_uInt16 nParam; @@ -386,10 +386,10 @@ sal_Bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer ) SbxParamInfo& p(aParams.back()); p.nUserData = nUserData; } - return sal_True; + return true; } -sal_Bool SbxInfo::StoreData( SvStream& rStrm ) const +bool SbxInfo::StoreData( SvStream& rStrm ) const { write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, aComment, RTL_TEXTENCODING_ASCII_US ); @@ -404,7 +404,7 @@ sal_Bool SbxInfo::StoreData( SvStream& rStrm ) const .WriteUInt16( (sal_uInt16) i->nFlags ) .WriteUInt32( (sal_uInt32) i->nUserData ); } - return sal_True; + return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx index 4ff018fd1e18..666bb5364d74 100644 --- a/basic/source/sbx/sbxbool.cxx +++ b/basic/source/sbx/sbxbool.cxx @@ -183,7 +183,7 @@ void ImpPutBool( SbxValues* p, sal_Int16 n ) { SbxValue* pVal = PTR_CAST(SbxValue,p->pObj); if( pVal ) - pVal->PutBool( sal_Bool( n != 0 ) ); + pVal->PutBool( n != 0 ); else SbxBase::SetError( SbxERR_NO_OBJECT ); break; diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx index 13cd64652cef..a474919f5e0b 100644 --- a/basic/source/sbx/sbxcoll.cxx +++ b/basic/source/sbx/sbxcoll.cxx @@ -232,16 +232,16 @@ void SbxCollection::CollRemove( SbxArray* pPar_ ) } } -sal_Bool SbxCollection::LoadData( SvStream& rStrm, sal_uInt16 nVer ) +bool SbxCollection::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { - sal_Bool bRes = SbxObject::LoadData( rStrm, nVer ); + bool bRes = SbxObject::LoadData( rStrm, nVer ); Initialize(); return bRes; } SbxStdCollection::SbxStdCollection - ( const OUString& rClass, const OUString& rElem, sal_Bool b ) + ( const OUString& rClass, const OUString& rElem, bool b ) : SbxCollection( rClass ), aElemClass( rElem ), bAddRemoveOk( b ) {} @@ -297,21 +297,21 @@ void SbxStdCollection::CollRemove( SbxArray* pPar_ ) SbxCollection::CollRemove( pPar_ ); } -sal_Bool SbxStdCollection::LoadData( SvStream& rStrm, sal_uInt16 nVer ) +bool SbxStdCollection::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { - sal_Bool bRes = SbxCollection::LoadData( rStrm, nVer ); + bool bRes = SbxCollection::LoadData( rStrm, nVer ); if( bRes ) { aElemClass = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_ASCII_US); - rStrm.ReadUChar( bAddRemoveOk ); + rStrm.ReadCharAsBool( bAddRemoveOk ); } return bRes; } -sal_Bool SbxStdCollection::StoreData( SvStream& rStrm ) const +bool SbxStdCollection::StoreData( SvStream& rStrm ) const { - sal_Bool bRes = SbxCollection::StoreData( rStrm ); + bool bRes = SbxCollection::StoreData( rStrm ); if( bRes ) { write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, aElemClass, diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index 0d80064153fd..e1894a29f13e 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -76,7 +76,7 @@ SbxObject& SbxObject::operator=( const SbxObject& r ) pDfltProp = r.pDfltProp; SetName( r.GetName() ); SetFlags( r.GetFlags() ); - SetModified( sal_True ); + SetModified( true ); } return *this; } @@ -131,7 +131,7 @@ void SbxObject::Clear() p->ResetFlag( SBX_WRITE ); p->SetFlag( SBX_DONTSTORE ); pDfltProp = NULL; - SetModified( sal_False ); + SetModified( false ); } void SbxObject::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, @@ -334,7 +334,7 @@ void SbxObject::SetDfltProperty( const OUString& rName ) pDfltProp = NULL; } aDfltPropName = rName; - SetModified( sal_True ); + SetModified( true ); } // Search of an already available variable. If it was located, @@ -419,7 +419,7 @@ SbxVariable* SbxObject::Make( const OUString& rName, SbxClassType ct, SbxDataTyp } pVar->SetParent( this ); pArray->Put( pVar, pArray->Count() ); - SetModified( sal_True ); + SetModified( true ); // The object listen always StartListening( pVar->GetBroadcaster(), true ); Broadcast( SBX_HINT_OBJECTCHANGED ); @@ -443,7 +443,7 @@ SbxObject* SbxObject::MakeObject( const OUString& rName, const OUString& rClass pVar->SetName( rName ); pVar->SetParent( this ); pObjs->Put( pVar, pObjs->Count() ); - SetModified( sal_True ); + SetModified( true ); // The object listen always StartListening( pVar->GetBroadcaster(), true ); Broadcast( SBX_HINT_OBJECTCHANGED ); @@ -490,7 +490,7 @@ void SbxObject::Insert( SbxVariable* pVar ) { pVar->SetParent( this ); } - SetModified( sal_True ); + SetModified( true ); Broadcast( SBX_HINT_OBJECTCHANGED ); #ifdef DBG_UTIL static const char* pCls[] = @@ -535,7 +535,7 @@ void SbxObject::QuickInsert( SbxVariable* pVar ) { pVar->SetParent( this ); } - SetModified( sal_True ); + SetModified( true ); #ifdef DBG_UTIL static const char* pCls[] = { "DontCare","Array","Value","Variable","Method","Property","Object" }; @@ -590,7 +590,7 @@ void SbxObject::Remove( SbxVariable* pVar ) { pVar_->SetParent( NULL ); } - SetModified( sal_True ); + SetModified( true ); Broadcast( SBX_HINT_OBJECTCHANGED ); } } @@ -618,18 +618,18 @@ static bool LoadArray( SvStream& rStrm, SbxObject* pThis, SbxArray* pArray ) // The load of an object is additive! -sal_Bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer ) +bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { // Help for the read in of old objects: just return TRUE, // LoadPrivateData() has to set the default status up if( !nVer ) { - return sal_True; + return true; } pDfltProp = NULL; if( !SbxVariable::LoadData( rStrm, nVer ) ) { - return sal_False; + return false; } // If it contains no alien object, insert ourselves if( aData.eType == SbxOBJECT && !aData.pObj ) @@ -644,7 +644,7 @@ sal_Bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer ) rStrm.ReadUInt32( nSize ); if( !LoadPrivateData( rStrm, nVer ) ) { - return sal_False; + return false; } sal_Size nNewPos = rStrm.Tell(); nPos += nSize; @@ -657,22 +657,22 @@ sal_Bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer ) !LoadArray( rStrm, this, pProps ) || !LoadArray( rStrm, this, pObjs ) ) { - return sal_False; + return false; } // Set properties if( !aDfltProp.isEmpty() ) { pDfltProp = (SbxProperty*) pProps->Find( aDfltProp, SbxCLASS_PROPERTY ); } - SetModified( sal_False ); - return sal_True; + SetModified( false ); + return true; } -sal_Bool SbxObject::StoreData( SvStream& rStrm ) const +bool SbxObject::StoreData( SvStream& rStrm ) const { if( !SbxVariable::StoreData( rStrm ) ) { - return sal_False; + return false; } OUString aDfltProp; if( pDfltProp ) @@ -685,7 +685,7 @@ sal_Bool SbxObject::StoreData( SvStream& rStrm ) const rStrm.WriteUInt32( (sal_uInt32) 0L ); if( !StorePrivateData( rStrm ) ) { - return sal_False; + return false; } sal_Size nNew = rStrm.Tell(); rStrm.Seek( nPos ); @@ -693,18 +693,18 @@ sal_Bool SbxObject::StoreData( SvStream& rStrm ) const rStrm.Seek( nNew ); if( !pMethods->Store( rStrm ) ) { - return sal_False; + return false; } if( !pProps->Store( rStrm ) ) { - return sal_False; + return false; } if( !pObjs->Store( rStrm ) ) { - return sal_False; + return false; } - ((SbxObject*) this)->SetModified( sal_False ); - return sal_True; + ((SbxObject*) this)->SetModified( false ); + return true; } OUString SbxObject::GenerateSource( const OUString &rLinePrefix, @@ -806,7 +806,7 @@ static bool CollectAttrs( const SbxBase* p, OUString& rRes ) } } -void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) +void SbxObject::Dump( SvStream& rStrm, bool bFill ) { // Shifting static sal_uInt16 nLevel = 0; diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 7ec18a7dce6f..dafcfc4dc007 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -619,7 +619,7 @@ static sal_uInt16 printfmtstr( const OUString& rStr, OUString& rRes, const OUStr } -sal_Bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen ) +bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen ) { SbxError eRes = SbxERR_OK; if( !CanWrite() ) @@ -642,11 +642,12 @@ sal_Bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen ) } if( eRes ) { - SetError( eRes ); return sal_False; + SetError( eRes ); + return false; } else { - return sal_True; + return true; } } diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index ac8ed662130e..8b222e9e086f 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -229,13 +229,13 @@ void SbxValue::Broadcast( sal_uIntPtr ) SbxValue* SbxValue::TheRealValue() const { - return TheRealValue( sal_True ); + return TheRealValue( true ); } // #55226 ship additional information bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal ); // sbunoobj.cxx -SbxValue* SbxValue::TheRealValue( sal_Bool bObjInObjError ) const +SbxValue* SbxValue::TheRealValue( bool bObjInObjError ) const { SbxValue* p = (SbxValue*) this; for( ;; ) @@ -308,9 +308,9 @@ SbxValue* SbxValue::TheRealValue( sal_Bool bObjInObjError ) const return p; } -sal_Bool SbxValue::Get( SbxValues& rRes ) const +bool SbxValue::Get( SbxValues& rRes ) const { - sal_Bool bRes = sal_False; + bool bRes = false; SbxError eOld = GetError(); if( eOld != SbxERR_OK ) ResetError(); @@ -399,7 +399,7 @@ sal_Bool SbxValue::Get( SbxValues& rRes ) const } if( !IsError() ) { - bRes = sal_True; + bRes = true; if( eOld != SbxERR_OK ) SetError( eOld ); } @@ -433,12 +433,12 @@ OUString SbxValue::GetOUString() const return aResult; } -sal_Bool SbxValue::GetBool() const +bool SbxValue::GetBool() const { SbxValues aRes; aRes.eType = SbxBOOL; Get( aRes ); - return sal_Bool( aRes.nUShort != 0 ); + return aRes.nUShort != 0; } #define GET( g, e, t, m ) \ @@ -462,9 +462,9 @@ GET( GetDecimal, SbxDECIMAL, SbxDecimal*, pDecimal ) //////////////////////////// Write data -sal_Bool SbxValue::Put( const SbxValues& rVal ) +bool SbxValue::Put( const SbxValues& rVal ) { - sal_Bool bRes = sal_False; + bool bRes = false; SbxError eOld = GetError(); if( eOld != SbxERR_OK ) ResetError(); @@ -477,7 +477,7 @@ sal_Bool SbxValue::Put( const SbxValues& rVal ) // If an object is requested, don't search the real values SbxValue* p = this; if( rVal.eType != SbxOBJECT ) - p = TheRealValue( sal_False ); // Don't allow an error here + p = TheRealValue( false ); // Don't allow an error here if( p ) { if( !p->CanWrite() ) @@ -561,11 +561,11 @@ sal_Bool SbxValue::Put( const SbxValues& rVal ) } if( !IsError() ) { - p->SetModified( sal_True ); + p->SetModified( true ); p->Broadcast( SBX_HINT_DATACHANGED ); if( eOld != SbxERR_OK ) SetError( eOld ); - bRes = sal_True; + bRes = true; } } } @@ -579,7 +579,7 @@ sal_Bool SbxValue::Put( const SbxValues& rVal ) // if Float were declared with ',' as the decimal separator or BOOl // explicit with "TRUE" or "FALSE". // Implementation in ImpConvStringExt (SBXSCAN.CXX) -sal_Bool SbxValue::PutStringExt( const OUString& r ) +bool SbxValue::PutStringExt( const OUString& r ) { // Copy; if it is Unicode convert it immediately OUString aStr( r ); @@ -594,7 +594,7 @@ sal_Bool SbxValue::PutStringExt( const OUString& r ) // Only if really something was converted, take the copy, // otherwise take the original (Unicode remains) - sal_Bool bRet; + bool bRet; if( ImpConvStringExt( aStr, eTargetType ) ) aRes.pOUString = (OUString*)&aStr; else @@ -614,7 +614,7 @@ sal_Bool SbxValue::PutStringExt( const OUString& r ) } Put( aRes ); - bRet = sal_Bool( !IsError() ); + bRet = bool( !IsError() ); // If FIXED resulted in an error, set it back // (UI-Action should not result in an error, but simply fail) @@ -625,67 +625,67 @@ sal_Bool SbxValue::PutStringExt( const OUString& r ) return bRet; } -sal_Bool SbxValue::PutBool( sal_Bool b ) +bool SbxValue::PutBool( bool b ) { SbxValues aRes; aRes.eType = SbxBOOL; aRes.nUShort = sal::static_int_cast< sal_uInt16 >(b ? SbxTRUE : SbxFALSE); Put( aRes ); - return sal_Bool( !IsError() ); + return !IsError(); } -sal_Bool SbxValue::PutEmpty() +bool SbxValue::PutEmpty() { - sal_Bool bRet = SetType( SbxEMPTY ); - SetModified( sal_True ); + bool bRet = SetType( SbxEMPTY ); + SetModified( true ); return bRet; } -sal_Bool SbxValue::PutNull() +bool SbxValue::PutNull() { - sal_Bool bRet = SetType( SbxNULL ); + bool bRet = SetType( SbxNULL ); if( bRet ) - SetModified( sal_True ); + SetModified( true ); return bRet; } // Special decimal methods -sal_Bool SbxValue::PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) +bool SbxValue::PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) { SbxValue::Clear(); aData.pDecimal = new SbxDecimal( rAutomationDec ); aData.pDecimal->addRef(); aData.eType = SbxDECIMAL; - return sal_True; + return true; } -sal_Bool SbxValue::fillAutomationDecimal +bool SbxValue::fillAutomationDecimal ( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) const { SbxDecimal* pDecimal = GetDecimal(); if( pDecimal != NULL ) { pDecimal->fillAutomationDecimal( rAutomationDec ); - return sal_True; + return true; } - return sal_False; + return false; } -sal_Bool SbxValue::PutString( const OUString& r ) +bool SbxValue::PutString( const OUString& r ) { SbxValues aRes; aRes.eType = SbxSTRING; aRes.pOUString = (OUString*) &r; Put( aRes ); - return sal_Bool( !IsError() ); + return !IsError(); } #define PUT( p, e, t, m ) \ -sal_Bool SbxValue::p( t n ) \ -{ SbxValues aRes(e); aRes.m = n; Put( aRes ); return sal_Bool( !IsError() ); } +bool SbxValue::p( t n ) \ +{ SbxValues aRes(e); aRes.m = n; Put( aRes ); return !IsError(); } PUT( PutByte, SbxBYTE, sal_uInt8, nByte ) PUT( PutChar, SbxCHAR, sal_Unicode, nChar ) @@ -705,7 +705,7 @@ PUT( PutDecimal, SbxDECIMAL, SbxDecimal*, pDecimal ) ////////////////////////// Setting of the data type -sal_Bool SbxValue::IsFixed() const +bool SbxValue::IsFixed() const { return ( (GetFlags() & SBX_FIXED) | (aData.eType & SbxBYREF) ) != 0; } @@ -714,22 +714,23 @@ sal_Bool SbxValue::IsFixed() const // or if it contains a complete convertible String // #41692, implement it for RTL and Basic-Core separately -sal_Bool SbxValue::IsNumeric() const +bool SbxValue::IsNumeric() const { return ImpIsNumeric( /*bOnlyIntntl*/false ); } -sal_Bool SbxValue::IsNumericRTL() const +bool SbxValue::IsNumericRTL() const { return ImpIsNumeric( /*bOnlyIntntl*/true ); } -sal_Bool SbxValue::ImpIsNumeric( bool bOnlyIntntl ) const +bool SbxValue::ImpIsNumeric( bool bOnlyIntntl ) const { if( !CanRead() ) { - SetError( SbxERR_PROP_WRITEONLY ); return sal_False; + SetError( SbxERR_PROP_WRITEONLY ); + return false; } // Test downcast!!! if( this->ISA(SbxVariable) ) @@ -744,14 +745,14 @@ sal_Bool SbxValue::ImpIsNumeric( bool bOnlyIntntl ) const SbxDataType t2; sal_uInt16 nLen = 0; if( ImpScan( s, n, t2, &nLen, /*bAllowIntntl*/false, bOnlyIntntl ) == SbxERR_OK ) - return sal_Bool( nLen == s.getLength() ); + return nLen == s.getLength(); } - return sal_False; + return false; } else - return sal_Bool( t == SbxEMPTY + return t == SbxEMPTY || ( t >= SbxINTEGER && t <= SbxCURRENCY ) - || ( t >= SbxCHAR && t <= SbxUINT ) ); + || ( t >= SbxCHAR && t <= SbxUINT ); } SbxClassType SbxValue::GetClass() const @@ -769,19 +770,20 @@ SbxDataType SbxValue::GetFullType() const return aData.eType; } -sal_Bool SbxValue::SetType( SbxDataType t ) +bool SbxValue::SetType( SbxDataType t ) { DBG_ASSERT( !( t & 0xF000 ), "SetType of BYREF|ARRAY is forbidden!" ); if( ( t == SbxEMPTY && aData.eType == SbxVOID ) || ( aData.eType == SbxEMPTY && t == SbxVOID ) ) - return sal_True; + return true; if( ( t & 0x0FFF ) == SbxVARIANT ) { // Try to set the data type to Variant ResetFlag( SBX_FIXED ); if( IsFixed() ) { - SetError( SbxERR_CONVERSION ); return sal_False; + SetError( SbxERR_CONVERSION ); + return false; } t = SbxEMPTY; } @@ -789,7 +791,8 @@ sal_Bool SbxValue::SetType( SbxDataType t ) { if( !CanWrite() || IsFixed() ) { - SetError( SbxERR_CONVERSION ); return sal_False; + SetError( SbxERR_CONVERSION ); + return false; } else { @@ -821,31 +824,33 @@ sal_Bool SbxValue::SetType( SbxDataType t ) aData.eType = t; } } - return sal_True; + return true; } -sal_Bool SbxValue::Convert( SbxDataType eTo ) +bool SbxValue::Convert( SbxDataType eTo ) { eTo = SbxDataType( eTo & 0x0FFF ); if( ( aData.eType & 0x0FFF ) == eTo ) - return sal_True; + return true; if( !CanWrite() ) - return sal_False; + return false; if( eTo == SbxVARIANT ) { // Trial to set the data type to Variant ResetFlag( SBX_FIXED ); if( IsFixed() ) { - SetError( SbxERR_CONVERSION ); return sal_False; + SetError( SbxERR_CONVERSION ); + return false; } else - return sal_True; + return true; } // Converting from null doesn't work. Once null, always null! if( aData.eType == SbxNULL ) { - SetError( SbxERR_CONVERSION ); return sal_False; + SetError( SbxERR_CONVERSION ); + return false; } // Conversion of the data: @@ -859,17 +864,17 @@ sal_Bool SbxValue::Convert( SbxDataType eTo ) { SetType( eTo ); Put( aNew ); - SetModified( sal_True ); + SetModified( true ); } Broadcast( SBX_HINT_CONVERTED ); - return sal_True; + return true; } else - return sal_False; + return false; } ////////////////////////////////// Calculating -sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) +bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) { #ifdef DISABLE_SCRIPTING bool bVBAInterop = false; @@ -1233,7 +1238,7 @@ Lbl_OpIsDouble: } Lbl_OpIsEmpty: - sal_Bool bRes = sal_Bool( !IsError() ); + bool bRes = !IsError(); if( bRes && eOld != SbxERR_OK ) SetError( eOld ); return bRes; @@ -1241,7 +1246,7 @@ Lbl_OpIsEmpty: // The comparison routine deliver TRUE or FALSE. -sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const +bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const { #ifdef DISABLE_SCRIPTING bool bVBAInterop = false; @@ -1249,7 +1254,7 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const bool bVBAInterop = SbiRuntime::isVBAEnabled(); #endif - sal_Bool bRes = sal_False; + bool bRes = false; SbxError eOld = GetError(); if( eOld != SbxERR_OK ) ResetError(); @@ -1257,24 +1262,24 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const SetError( SbxERR_PROP_WRITEONLY ); else if( GetType() == SbxNULL && rOp.GetType() == SbxNULL && !bVBAInterop ) { - bRes = sal_True; + bRes = true; } else if( GetType() == SbxEMPTY && rOp.GetType() == SbxEMPTY ) - bRes = !bVBAInterop ? sal_True : ( eOp == SbxEQ ? sal_True : sal_False ); + bRes = !bVBAInterop || ( eOp == SbxEQ ); // Special rule 1: If an operand is null, the result is FALSE else if( GetType() == SbxNULL || rOp.GetType() == SbxNULL ) - bRes = sal_False; + bRes = false; // Special rule 2: If both are variant and one is numeric // and the other is a String, num is < str else if( !IsFixed() && !rOp.IsFixed() && ( rOp.GetType() == SbxSTRING && GetType() != SbxSTRING && IsNumeric() ) && !bVBAInterop ) - bRes = sal_Bool( eOp == SbxLT || eOp == SbxLE || eOp == SbxNE ); + bRes = eOp == SbxLT || eOp == SbxLE || eOp == SbxNE; else if( !IsFixed() && !rOp.IsFixed() && ( GetType() == SbxSTRING && rOp.GetType() != SbxSTRING && rOp.IsNumeric() ) && !bVBAInterop ) - bRes = sal_Bool( eOp == SbxGT || eOp == SbxGE || eOp == SbxNE ); + bRes = eOp == SbxGT || eOp == SbxGE || eOp == SbxNE; else { SbxValues aL, aR; @@ -1286,17 +1291,17 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const if( Get( aL ) && rOp.Get( aR ) ) switch( eOp ) { case SbxEQ: - bRes = sal_Bool( *aL.pOUString == *aR.pOUString ); break; + bRes = ( *aL.pOUString == *aR.pOUString ); break; case SbxNE: - bRes = sal_Bool( *aL.pOUString != *aR.pOUString ); break; + bRes = ( *aL.pOUString != *aR.pOUString ); break; case SbxLT: - bRes = sal_Bool( *aL.pOUString < *aR.pOUString ); break; + bRes = ( *aL.pOUString < *aR.pOUString ); break; case SbxGT: - bRes = sal_Bool( *aL.pOUString > *aR.pOUString ); break; + bRes = ( *aL.pOUString > *aR.pOUString ); break; case SbxLE: - bRes = sal_Bool( *aL.pOUString <= *aR.pOUString ); break; + bRes = ( *aL.pOUString <= *aR.pOUString ); break; case SbxGE: - bRes = sal_Bool( *aL.pOUString >= *aR.pOUString ); break; + bRes = ( *aL.pOUString >= *aR.pOUString ); break; default: SetError( SbxERR_NOTIMP ); } @@ -1310,17 +1315,17 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const switch( eOp ) { case SbxEQ: - bRes = sal_Bool( aL.nSingle == aR.nSingle ); break; + bRes = ( aL.nSingle == aR.nSingle ); break; case SbxNE: - bRes = sal_Bool( aL.nSingle != aR.nSingle ); break; + bRes = ( aL.nSingle != aR.nSingle ); break; case SbxLT: - bRes = sal_Bool( aL.nSingle < aR.nSingle ); break; + bRes = ( aL.nSingle < aR.nSingle ); break; case SbxGT: - bRes = sal_Bool( aL.nSingle > aR.nSingle ); break; + bRes = ( aL.nSingle > aR.nSingle ); break; case SbxLE: - bRes = sal_Bool( aL.nSingle <= aR.nSingle ); break; + bRes = ( aL.nSingle <= aR.nSingle ); break; case SbxGE: - bRes = sal_Bool( aL.nSingle >= aR.nSingle ); break; + bRes = ( aL.nSingle >= aR.nSingle ); break; default: SetError( SbxERR_NOTIMP ); } @@ -1336,17 +1341,17 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const switch( eOp ) { case SbxEQ: - bRes = sal_Bool( eRes == SbxDecimal::EQ ); break; + bRes = ( eRes == SbxDecimal::EQ ); break; case SbxNE: - bRes = sal_Bool( eRes != SbxDecimal::EQ ); break; + bRes = ( eRes != SbxDecimal::EQ ); break; case SbxLT: - bRes = sal_Bool( eRes == SbxDecimal::LT ); break; + bRes = ( eRes == SbxDecimal::LT ); break; case SbxGT: - bRes = sal_Bool( eRes == SbxDecimal::GT ); break; + bRes = ( eRes == SbxDecimal::GT ); break; case SbxLE: - bRes = sal_Bool( eRes != SbxDecimal::GT ); break; + bRes = ( eRes != SbxDecimal::GT ); break; case SbxGE: - bRes = sal_Bool( eRes != SbxDecimal::LT ); break; + bRes = ( eRes != SbxDecimal::LT ); break; default: SetError( SbxERR_NOTIMP ); } @@ -1368,17 +1373,17 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const switch( eOp ) { case SbxEQ: - bRes = sal_Bool( aL.nDouble == aR.nDouble ); break; + bRes = ( aL.nDouble == aR.nDouble ); break; case SbxNE: - bRes = sal_Bool( aL.nDouble != aR.nDouble ); break; + bRes = ( aL.nDouble != aR.nDouble ); break; case SbxLT: - bRes = sal_Bool( aL.nDouble < aR.nDouble ); break; + bRes = ( aL.nDouble < aR.nDouble ); break; case SbxGT: - bRes = sal_Bool( aL.nDouble > aR.nDouble ); break; + bRes = ( aL.nDouble > aR.nDouble ); break; case SbxLE: - bRes = sal_Bool( aL.nDouble <= aR.nDouble ); break; + bRes = ( aL.nDouble <= aR.nDouble ); break; case SbxGE: - bRes = sal_Bool( aL.nDouble >= aR.nDouble ); break; + bRes = ( aL.nDouble >= aR.nDouble ); break; default: SetError( SbxERR_NOTIMP ); } @@ -1390,7 +1395,7 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const if ( bVBAInterop && eOp == SbxEQ && GetError() == SbxERR_CONVERSION ) { ResetError(); - bRes = sal_False; + bRes = false; } } } @@ -1402,7 +1407,7 @@ sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const ///////////////////////////// Reading/Writing -sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) +bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) { // #TODO see if these types are really dumped to any stream // more than likely this is functionality used in the binfilter alone @@ -1427,7 +1432,7 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) if( ImpScan( aVal, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE ) { aData.nSingle = 0.0F; - return sal_False; + return false; } aData.nSingle = (float) d; break; @@ -1442,7 +1447,7 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) if( ImpScan( aVal, aData.nDouble, t, NULL ) != SbxERR_OK ) { aData.nDouble = 0.0; - return sal_False; + return false; } break; } @@ -1486,7 +1491,7 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) break; case 1: aData.pObj = SbxBase::Load( r ); - return sal_Bool( aData.pObj != NULL ); + return ( aData.pObj != NULL ); case 2: aData.pObj = this; break; @@ -1549,12 +1554,12 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) aData.eType = SbxNULL; DBG_ASSERT( !this, "Loaded a non-supported data type" ); - return sal_False; + return false; } - return sal_True; + return true; } - sal_Bool SbxValue::StoreData( SvStream& r ) const + bool SbxValue::StoreData( SvStream& r ) const { sal_uInt16 nType = sal::static_int_cast< sal_uInt16 >(aData.eType); r.WriteUInt16( nType ); @@ -1650,9 +1655,9 @@ sal_Bool SbxValue::LoadData( SvStream& r, sal_uInt16 ) break; default: DBG_ASSERT( !this, "Saving a non-supported data type" ); - return sal_False; + return false; } - return sal_True; + return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 4c8f98084e67..c49ad3914abb 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -192,7 +192,7 @@ SbxInfo* SbxVariable::GetInfo() Broadcast( SBX_HINT_INFOWANTED ); if( pInfo.Is() ) { - SetModified( sal_True ); + SetModified( true ); } } return pInfo; @@ -390,7 +390,7 @@ SbxClassType SbxVariable::GetClass() const return SbxCLASS_VARIABLE; } -void SbxVariable::SetModified( sal_Bool b ) +void SbxVariable::SetModified( bool b ) { if( IsSet( SBX_NO_MODIFY ) ) { @@ -470,7 +470,7 @@ void SbxVariable::ClearComListener( void ) ////////////////////////////// Loading/Saving -sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) +bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { sal_uInt16 nType; sal_uInt8 cMark; @@ -479,7 +479,7 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { if( !SbxValue::LoadData( rStrm, nVer ) ) { - return sal_False; + return false; } maName = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_ASCII_US); @@ -524,7 +524,7 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) if( ImpScan( aTmpString, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE ) { aTmp.nSingle = 0; - return sal_False; + return false; } aTmp.nSingle = (float) d; break; @@ -539,7 +539,7 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK ) { aTmp.nDouble = 0; - return sal_False; + return false; } break; } @@ -553,12 +553,12 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) default: aData.eType = SbxNULL; DBG_ASSERT( !this, "Loaded a non-supported data type" ); - return sal_False; + return false; } // putt value if( nType != SbxNULL && nType != SbxEMPTY && !Put( aTmp ) ) { - return sal_False; + return false; } } rStrm.ReadUChar( cMark ); @@ -569,7 +569,7 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { if( cMark > 2 ) { - return sal_False; + return false; } pInfo = new SbxInfo; pInfo->LoadData( rStrm, (sal_uInt16) cMark ); @@ -577,18 +577,18 @@ sal_Bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) // Load private data only, if it is a SbxVariable if( GetClass() == SbxCLASS_VARIABLE && !LoadPrivateData( rStrm, nVer ) ) { - return sal_False; + return false; } ((SbxVariable*) this)->Broadcast( SBX_HINT_DATACHANGED ); nHash = MakeHashCode( maName ); - SetModified( sal_True ); - return sal_True; + SetModified( true ); + return true; } -sal_Bool SbxVariable::StoreData( SvStream& rStrm ) const +bool SbxVariable::StoreData( SvStream& rStrm ) const { rStrm.WriteUChar( (sal_uInt8) 0xFF ); // Marker - sal_Bool bValStore; + bool bValStore; if( this->IsA( TYPE(SbxMethod) ) ) { // #50200 Avoid that objects , which during the runtime @@ -611,7 +611,7 @@ sal_Bool SbxVariable::StoreData( SvStream& rStrm ) const } if( !bValStore ) { - return sal_False; + return false; } write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, maName, RTL_TEXTENCODING_ASCII_US); @@ -632,7 +632,7 @@ sal_Bool SbxVariable::StoreData( SvStream& rStrm ) const } else { - return sal_True; + return true; } } @@ -702,7 +702,7 @@ void SbxAlias::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, } } -void SbxVariable::Dump( SvStream& rStrm, sal_Bool bFill ) +void SbxVariable::Dump( SvStream& rStrm, bool bFill ) { OString aBNameStr(OUStringToOString(GetName( SbxNAME_SHORT_TYPES ), RTL_TEXTENCODING_ASCII_US)); rStrm.WriteCharPtr( "Variable( " ) -- cgit v1.2.3