summaryrefslogtreecommitdiff
path: root/include/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-24 08:37:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-24 10:53:05 +0200
commit57de1a3c279d4ecfaa020626296f7e667765e5a3 (patch)
treef7d49701357ae4ccb4729bbf9fd50ceac6801393 /include/svl
parent90e3b47b52f26420425a7417d2f51b6a386282d9 (diff)
simplify call sites of SfxItemPool::Put
use template to make return type match input type, so we don't need to cast at the call sites Change-Id: I1e65f362c67f74c9a230cdbc1db12545b28eb499 Reviewed-on: https://gerrit.libreoffice.org/71216 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svl')
-rw-r--r--include/svl/itempool.hxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
index 391e1b942544..7f74cb85c11d 100644
--- a/include/svl/itempool.hxx
+++ b/include/svl/itempool.hxx
@@ -146,10 +146,10 @@ public:
virtual SfxItemPool* Clone() const;
const OUString& GetName() const;
- const SfxPoolItem& Put( std::unique_ptr<SfxPoolItem> xItem, sal_uInt16 nWhich = 0 )
- { return PutImpl( *xItem.release(), nWhich, /*bPassingOwnership*/true); }
- const SfxPoolItem& Put( const SfxPoolItem& rItem, sal_uInt16 nWhich = 0 )
- { return PutImpl( rItem, nWhich, /*bPassingOwnership*/false); }
+ template<class T> const T& Put( std::unique_ptr<T> xItem, sal_uInt16 nWhich = 0 )
+ { return static_cast<const T&>(PutImpl( *xItem.release(), nWhich, /*bPassingOwnership*/true)); }
+ template<class T> const T& Put( const T& rItem, sal_uInt16 nWhich = 0 )
+ { return static_cast<const T&>(PutImpl( rItem, nWhich, /*bPassingOwnership*/false)); }
void Remove( const SfxPoolItem& );
const SfxPoolItem& GetDefaultItem( sal_uInt16 nWhich ) const;