summaryrefslogtreecommitdiff
path: root/include/svl
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-10-16 12:06:21 +0200
committerJan Holesovsky <kendy@collabora.com>2015-10-16 12:12:28 +0200
commitadeefc6295b1cf411b47b9b4213c16effea9d832 (patch)
tree04eb6620ab4bc1ed72b7c187994c13be30726f52 /include/svl
parent20248b82be361279f2b4814280b0371658ca27c0 (diff)
sfx items: Kill the unreadable & misplaced SFX_ITEMSET_ARG too.
Change-Id: I1e0f96dce2b9cf9da32f4f577cf76e1d8824d37a
Diffstat (limited to 'include/svl')
-rw-r--r--include/svl/itemset.hxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
index 4685441ecbf1..52d4d7a7f688 100644
--- a/include/svl/itemset.hxx
+++ b/include/svl/itemset.hxx
@@ -87,12 +87,21 @@ public:
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
+ /// Templatized version to directly return the correct type.
+ template<class T> const T* GetItem(sal_uInt16 nWhich, bool bSearchInParent = true) const
{
return dynamic_cast<const T*>(GetItem(nWhich, bSearchInParent));
}
+ /// Templatized static version to directly return the correct type if the SfxItemSet is available.
+ template<class T> static const T* GetItem(const SfxItemSet* pItemSet, sal_uInt16 nWhich, bool bSearchInParent = true)
+ {
+ if (pItemSet)
+ return pItemSet->GetItem<T>(nWhich, bSearchInParent);
+
+ return nullptr;
+ }
+
// Get Which-value of the item at position nPos
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const;