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/sbxbase.cxx | |
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/sbxbase.cxx')
-rw-r--r-- | basic/source/sbx/sbxbase.cxx | 16 |
1 files changed, 9 insertions, 7 deletions
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 ); |