return by reference instead of pointer

This commit is contained in:
Caolán McNamara 2011-05-17 21:05:15 +01:00
parent a2dc331fb6
commit 3f5470899c
3 changed files with 12 additions and 12 deletions

View file

@ -170,7 +170,7 @@ SfxPickList::PickListEntry* SfxPickList::GetPickListEntry( sal_uInt32 nIndex )
return 0;
}
SfxPickList* SfxPickList::GetOrCreate( const sal_uInt32 nMenuSize )
SfxPickList& SfxPickList::GetOrCreate( const sal_uInt32 nMenuSize )
{
if ( !pUniqueInstance )
{
@ -179,13 +179,13 @@ SfxPickList* SfxPickList::GetOrCreate( const sal_uInt32 nMenuSize )
pUniqueInstance = new SfxPickList( nMenuSize );
}
return pUniqueInstance;
return *pUniqueInstance;
}
SfxPickList* SfxPickList::Get()
SfxPickList& SfxPickList::Get()
{
::osl::MutexGuard aGuard( thePickListMutex::get() );
return pUniqueInstance;
return *pUniqueInstance;
}
void SfxPickList::Delete()
@ -258,10 +258,10 @@ void SfxPickList::CreatePickListEntries()
void SfxPickList::CreateMenuEntries( Menu* pMenu )
{
static sal_Bool bPickListMenuInitializing = sal_False;
::osl::MutexGuard aGuard( thePickListMutex::get() );
static sal_Bool bPickListMenuInitializing = sal_False;
if ( bPickListMenuInitializing ) // method is not reentrant!
return;
@ -295,7 +295,7 @@ void SfxPickList::ExecuteEntry( sal_uInt32 nIndex )
{
::osl::ClearableMutexGuard aGuard( thePickListMutex::get() );
PickListEntry *pPick = SfxPickList::Get()->GetPickListEntry( nIndex );
PickListEntry *pPick = SfxPickList::Get().GetPickListEntry( nIndex );
if ( pPick )
{
@ -327,7 +327,7 @@ void SfxPickList::ExecuteMenuEntry( sal_uInt16 nId )
String SfxPickList::GetMenuEntryTitle( sal_uInt32 nIndex )
{
PickListEntry *pPick = SfxPickList::Get()->GetPickListEntry( nIndex );
PickListEntry *pPick = SfxPickList::Get().GetPickListEntry( nIndex );
if ( pPick )
return pPick->aTitle;

View file

@ -67,8 +67,8 @@ class SfxPickList : public SfxListener
void RemovePickListEntries();
public:
static SfxPickList* GetOrCreate( const sal_uInt32 nMenuSize );
static SfxPickList* Get();
static SfxPickList& GetOrCreate( const sal_uInt32 nMenuSize );
static SfxPickList& Get();
static void Delete();
sal_uInt32 GetAllowedMenuSize() { return m_nAllowedMenuSize; }

View file

@ -899,7 +899,7 @@ IMPL_LINK( SfxVirtualMenu, Activate, Menu *, pMenu )
// ggf. Pick-Menu erzeugen
if ( pParent && pSVMenu == pParent->pPickMenu )
{
SfxPickList::Get()->CreateMenuEntries( pParent->pPickMenu );
SfxPickList::Get().CreateMenuEntries( pParent->pPickMenu );
}
else
pPickMenu = pSVMenu->GetPopupMenu(SID_PICKLIST);
@ -1068,7 +1068,7 @@ IMPL_LINK( SfxVirtualMenu, Select, Menu *, pMenu )
}
else if ( nSlotId >= START_ITEMID_PICKLIST && nSlotId <= END_ITEMID_PICKLIST )
{
SfxPickList::Get()->ExecuteMenuEntry( nSlotId );
SfxPickList::Get().ExecuteMenuEntry( nSlotId );
return sal_True;
}