summaryrefslogtreecommitdiff
path: root/basic/source/sbx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-12-08 10:26:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-12-08 12:35:09 +0000
commita66731982e93cdcc5beaa5b0586a7f12a7fc0ef6 (patch)
tree19064090be4d97781c16aa6e79a4f7a09d561ae9 /basic/source/sbx
parent20475c78db5c62f2c8711e59753476bd9b4e2f1c (diff)
convert SFX_HINT to scoped enum
Notes (*) In SC, BULK_DATACHANGED was or'ed into the hint id. Replaced with a dynamic_cast check. (*) In SC, removed the hint id field from ScIndexHint, no point in storing the hint id twice (*) Fold the SfxStyleSheetHintId enum into the new SfxHintId enum, no point in storing two different hint ids (*) In some cases, multiple #define's used to map to the same SFX_HINT value (notably the SFX_HINT_USER* values). I made all of those separate values. Change-Id: I990e2fb587335ebc51c9005588c6a44f768d9de5 Reviewed-on: https://gerrit.libreoffice.org/31751 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/sbx')
-rw-r--r--basic/source/sbx/sbxcoll.cxx6
-rw-r--r--basic/source/sbx/sbxexec.cxx2
-rw-r--r--basic/source/sbx/sbxobj.cxx14
-rw-r--r--basic/source/sbx/sbxvalue.cxx14
-rw-r--r--basic/source/sbx/sbxvar.cxx20
5 files changed, 28 insertions, 28 deletions
diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx
index 8971c866619a..3fa3b690d19b 100644
--- a/basic/source/sbx/sbxcoll.cxx
+++ b/basic/source/sbx/sbxcoll.cxx
@@ -117,9 +117,9 @@ void SbxCollection::Notify( SfxBroadcaster& rCst, const SfxHint& rHint )
const SbxHint* p = dynamic_cast<const SbxHint*>(&rHint);
if( p )
{
- const sal_uInt32 nId = p->GetId();
- bool bRead = ( nId == SBX_HINT_DATAWANTED );
- bool bWrite = ( nId == SBX_HINT_DATACHANGED );
+ const SfxHintId nId = p->GetId();
+ bool bRead = ( nId == SfxHintId::BasicDataWanted );
+ bool bWrite = ( nId == SfxHintId::BasicDataChanged );
SbxVariable* pVar = p->GetVar();
SbxArray* pArg = pVar->GetParameters();
if( bRead || bWrite )
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index 47775b02a554..24afd3388d0b 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -261,7 +261,7 @@ static SbxVariableRef Assign( SbxObject* pObj, SbxObject* pGbl, const sal_Unicod
}
else
// Simple call: once activating
- refVar->Broadcast( SBX_HINT_DATAWANTED );
+ refVar->Broadcast( SfxHintId::BasicDataWanted );
}
*ppBuf = p;
return refVar;
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index e4e7e3827493..098a580a9869 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -136,9 +136,9 @@ void SbxObject::Notify( SfxBroadcaster&, const SfxHint& rHint )
const SbxHint* p = dynamic_cast<const SbxHint*>(&rHint);
if( p )
{
- const sal_uInt32 nId = p->GetId();
- bool bRead = ( nId == SBX_HINT_DATAWANTED );
- bool bWrite = ( nId == SBX_HINT_DATACHANGED );
+ const SfxHintId nId = p->GetId();
+ bool bRead = ( nId == SfxHintId::BasicDataWanted );
+ bool bWrite = ( nId == SfxHintId::BasicDataChanged );
SbxVariable* pVar = p->GetVar();
if( bRead || bWrite )
{
@@ -295,7 +295,7 @@ bool SbxObject::Call( const OUString& rName, SbxArray* pParam )
{
pMeth->SetParameters( pParam );
}
- pMeth->Broadcast( SBX_HINT_DATAWANTED );
+ pMeth->Broadcast( SfxHintId::BasicDataWanted );
pMeth->SetParameters( nullptr );
return true;
}
@@ -413,7 +413,7 @@ SbxVariable* SbxObject::Make( const OUString& rName, SbxClassType ct, SbxDataTyp
SetModified( true );
// The object listen always
StartListening( pVar->GetBroadcaster(), true );
- Broadcast( SBX_HINT_OBJECTCHANGED );
+ Broadcast( SfxHintId::BasicObjectChanged );
return pVar;
}
@@ -457,7 +457,7 @@ void SbxObject::Insert( SbxVariable* pVar )
pVar->SetParent( this );
}
SetModified( true );
- Broadcast( SBX_HINT_OBJECTCHANGED );
+ Broadcast( SfxHintId::BasicObjectChanged );
#ifdef DBG_UTIL
static const char* pCls[] =
{ "DontCare","Array","Value","Variable","Method","Property","Object" };
@@ -557,7 +557,7 @@ void SbxObject::Remove( SbxVariable* pVar )
pVar_->SetParent( nullptr );
}
SetModified( true );
- Broadcast( SBX_HINT_OBJECTCHANGED );
+ Broadcast( SfxHintId::BasicObjectChanged );
}
}
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 1c9352368517..6ce2239206e1 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -59,7 +59,7 @@ SbxValue::SbxValue( const SbxValue& r )
}
else
{
- const_cast<SbxValue*>(&r)->Broadcast( SBX_HINT_DATAWANTED );
+ const_cast<SbxValue*>(&r)->Broadcast( SfxHintId::BasicDataWanted );
aData = r.aData;
// Copy pointer, increment references
switch( aData.eType )
@@ -133,7 +133,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r )
SbxValue::~SbxValue()
{
- Broadcast( SBX_HINT_DYING );
+ Broadcast( SfxHintId::BasicDying );
SetFlag( SbxFlagBits::Write );
SbxValue::Clear();
}
@@ -182,7 +182,7 @@ void SbxValue::Clear()
// Dummy
-void SbxValue::Broadcast( sal_uInt32 )
+void SbxValue::Broadcast( SfxHintId )
{}
//////////////////////////// Readout data
@@ -284,7 +284,7 @@ bool SbxValue::Get( SbxValues& rRes ) const
p = TheRealValue( true );
if( p )
{
- p->Broadcast( SBX_HINT_DATAWANTED );
+ p->Broadcast( SfxHintId::BasicDataWanted );
switch( rRes.eType )
{
case SbxEMPTY:
@@ -519,7 +519,7 @@ bool SbxValue::Put( const SbxValues& rVal )
if( !IsError() )
{
p->SetModified( true );
- p->Broadcast( SBX_HINT_DATACHANGED );
+ p->Broadcast( SfxHintId::BasicDataChanged );
if( eOld != ERRCODE_SBX_OK )
SetError( eOld );
bRes = true;
@@ -689,7 +689,7 @@ bool SbxValue::ImpIsNumeric( bool bOnlyIntntl ) const
}
// Test downcast!!!
if( nullptr != dynamic_cast<const SbxVariable*>( this) )
- const_cast<SbxVariable*>(static_cast<const SbxVariable*>(this))->Broadcast( SBX_HINT_DATAWANTED );
+ const_cast<SbxVariable*>(static_cast<const SbxVariable*>(this))->Broadcast( SfxHintId::BasicDataWanted );
SbxDataType t = GetType();
if( t == SbxSTRING )
{
@@ -817,7 +817,7 @@ bool SbxValue::Convert( SbxDataType eTo )
Put( aNew );
SetModified( true );
}
- Broadcast( SBX_HINT_CONVERTED );
+ Broadcast( SfxHintId::BasicConverted );
return true;
}
else
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 27766dfc7fd4..5e8307d0a6a9 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -155,20 +155,20 @@ SbxArray* SbxVariable::GetParameters() const
// Perhaps some day one could cut the parameter 0.
// Then the copying will be dropped...
-void SbxVariable::Broadcast( sal_uInt32 nHintId )
+void SbxVariable::Broadcast( SfxHintId nHintId )
{
if( pCst && !IsSet( SbxFlagBits::NoBroadcast ) )
{
// Because the method could be called from outside, check the
// rights here again
- if( nHintId & SBX_HINT_DATAWANTED )
+ if( nHintId == SfxHintId::BasicDataWanted )
{
if( !CanRead() )
{
return;
}
}
- if( nHintId & SBX_HINT_DATACHANGED )
+ if( nHintId == SfxHintId::BasicDataChanged )
{
if( !CanWrite() )
{
@@ -201,7 +201,7 @@ SbxInfo* SbxVariable::GetInfo()
{
if( !pInfo.Is() )
{
- Broadcast( SBX_HINT_INFOWANTED );
+ Broadcast( SfxHintId::BasicInfoWanted );
if( pInfo.Is() )
{
SetModified( true );
@@ -582,7 +582,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
pInfo = new SbxInfo;
pInfo->LoadData( rStrm, (sal_uInt16) cMark );
}
- Broadcast( SBX_HINT_DATACHANGED );
+ Broadcast( SfxHintId::BasicDataChanged );
nHash = MakeHashCode( maName );
SetModified( true );
return true;
@@ -662,20 +662,20 @@ SbxAlias::~SbxAlias()
}
}
-void SbxAlias::Broadcast( sal_uInt32 nHt )
+void SbxAlias::Broadcast( SfxHintId nHt )
{
if( xAlias.Is() )
{
xAlias->SetParameters( GetParameters() );
- if( nHt == SBX_HINT_DATAWANTED )
+ if( nHt == SfxHintId::BasicDataWanted )
{
SbxVariable::operator=( *xAlias );
}
- else if( nHt == SBX_HINT_DATACHANGED || nHt == SBX_HINT_CONVERTED )
+ else if( nHt == SfxHintId::BasicDataChanged || nHt == SfxHintId::BasicConverted )
{
*xAlias = *this;
}
- else if( nHt == SBX_HINT_INFOWANTED )
+ else if( nHt == SfxHintId::BasicInfoWanted )
{
xAlias->Broadcast( nHt );
pInfo = xAlias->GetInfo();
@@ -686,7 +686,7 @@ void SbxAlias::Broadcast( sal_uInt32 nHt )
void SbxAlias::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
const SbxHint* p = dynamic_cast<const SbxHint*>(&rHint);
- if( p && p->GetId() == SBX_HINT_DYING )
+ if( p && p->GetId() == SfxHintId::BasicDying )
{
xAlias.Clear();
// delete the alias?