sfx items: Introduce a templatized version of SfxItemSet::GetItem().
Change-Id: I821622fc1f8415f2ddd14744f33b46fa76f00039
This commit is contained in:
parent
e5be07f516
commit
20248b82be
2 changed files with 11 additions and 2 deletions
|
@ -88,7 +88,10 @@ public:
|
|||
*/
|
||||
template<class T> const T* GetArg(sal_uInt16 nSlotId) const
|
||||
{
|
||||
return dynamic_cast<const T*>(GetItem(pArgs, nSlotId));
|
||||
if (pArgs)
|
||||
return pArgs->GetItem<T>(nSlotId, false);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ReleaseArgs();
|
||||
|
|
|
@ -84,9 +84,15 @@ public:
|
|||
sal_uInt16 TotalCount() const;
|
||||
|
||||
const SfxPoolItem& Get( sal_uInt16 nWhich, bool bSrchInParent = true ) const;
|
||||
const SfxPoolItem* GetItem( sal_uInt16 nWhich, bool bSrchInParent = true,
|
||||
const SfxPoolItem* GetItem( sal_uInt16 nWhich, bool bSearchInParent = true,
|
||||
TypeId aItemType = 0 ) const;
|
||||
|
||||
/// Templatized version of the GetItem().
|
||||
template<class T> const T* GetItem(sal_uInt16 nWhich, bool bSearchInParent = true) const
|
||||
{
|
||||
return dynamic_cast<const T*>(GetItem(nWhich, bSearchInParent));
|
||||
}
|
||||
|
||||
// Get Which-value of the item at position nPos
|
||||
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue