diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-02 12:19:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-03 16:04:03 +0100 |
commit | a4fbb496ef001d62fce0ad3cdd7a829f99aa182e (patch) | |
tree | 46251b839097ec9486da8da98bacf507ba4692e9 /include/sfx2 | |
parent | aa7f880e8a847686bc4ec2d8ca5f74f39c32abac (diff) |
more TypedWhichId in SfxShell and SfxTabDialog
and remove some unnecessary local copies of pool items
Change-Id: Ifdac8d84658fd4b803267038592d7da370e23a0d
Reviewed-on: https://gerrit.libreoffice.org/49138
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/sfx2')
-rw-r--r-- | include/sfx2/shell.hxx | 5 | ||||
-rw-r--r-- | include/sfx2/tabdlg.hxx | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx index e51738e32549..55e15f0e8655 100644 --- a/include/sfx2/shell.hxx +++ b/include/sfx2/shell.hxx @@ -24,6 +24,7 @@ #include <rtl/ustring.hxx> #include <sal/config.h> #include <sal/types.h> +#include <svl/typedwhich.hxx> #include <sfx2/dllapi.h> #include <sfx2/sfxuno.hxx> #include <svl/SfxBroadcaster.hxx> @@ -424,6 +425,10 @@ public: <SfxShell::RemoveItem(sal_uInt16)> */ const SfxPoolItem* GetItem( sal_uInt16 nSlotId ) const; + template<class T> const T* GetItem( TypedWhichId<T> nWhich ) const + { + return static_cast<const T*>(GetItem(sal_uInt16(nWhich))); + } /** With this method, any objects of subclasses of <SfxPoolItem> can be made diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index 409b15196307..ce7498c2182b 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -239,6 +239,10 @@ protected: sal_uInt16 GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const { return pSet->GetPool()->GetWhich( nSlot, bDeep ); } const SfxPoolItem* GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true ); + template<class T> const T* GetOldItem( const SfxItemSet& rSet, TypedWhichId<T> nSlot, bool bDeep = true ) + { + return static_cast<const T*>(GetOldItem(rSet, sal_uInt16(nSlot), bDeep)); + } SfxTabDialog* GetTabDialog() const; void AddItemConnection( sfx::ItemConnectionBase* pConnection ); @@ -269,6 +273,10 @@ public: virtual void PageCreated (const SfxAllItemSet& aSet); virtual void ChangesApplied(); static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true ); + template<class T> static const T* GetItem( const SfxItemSet& rSet, TypedWhichId<T> nSlot, bool bDeep = true ) + { + return static_cast<const T*>(GetItem(rSet, sal_uInt16(nSlot), bDeep)); + } void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame); css::uno::Reference< css::frame::XFrame > GetFrame(); |