return by reference instead of pointer
This commit is contained in:
parent
a2dc331fb6
commit
3f5470899c
3 changed files with 12 additions and 12 deletions
|
@ -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;
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue