diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-02-01 14:35:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-02-02 07:46:43 +0100 |
commit | 13d6bfa5bb017ad2b107c9db982369ea050ccbdf (patch) | |
tree | 4eed6571e68c79f5b49426bfd9f6569de4fe4e3c | |
parent | a3c78bbee81a82bb50ed2b92944d9946348f73ad (diff) |
convert OfaRefItem to a normal class
only instantiated with one type, so just turn it into a normal class
Change-Id: If3ae908f3e226ae9f4d3b81a7a7d9ba492ccda4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129283
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svx/ofaitem.hxx | 23 | ||||
-rw-r--r-- | include/svx/svxids.hrc | 3 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel3.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/poolitem.cxx | 2 | ||||
-rw-r--r-- | svx/sdi/svxitems.sdi | 2 | ||||
-rw-r--r-- | svx/source/items/ofaitem.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 2 |
8 files changed, 31 insertions, 21 deletions
diff --git a/include/svx/ofaitem.hxx b/include/svx/ofaitem.hxx index ce86b0653a87..5e9e52b92e38 100644 --- a/include/svx/ofaitem.hxx +++ b/include/svx/ofaitem.hxx @@ -37,24 +37,17 @@ public: void* GetValue() const { return pPtr; } }; -template <class reference_type> -class OfaRefItem final : public SfxPoolItem +class XColorList; +class SVX_DLLPUBLIC OfaXColorListItem final : public SfxPoolItem { private: - rtl::Reference<reference_type> mxRef; + rtl::Reference<XColorList> mxRef; public: - OfaRefItem( sal_uInt16 _nWhich, const rtl::Reference<reference_type> &xRef ) - : SfxPoolItem( _nWhich ), mxRef( xRef ) - {} - virtual bool operator==( const SfxPoolItem& rItem ) const override - { - return SfxPoolItem::operator==(rItem) - && mxRef == static_cast<OfaRefItem<reference_type> const &>(rItem).mxRef; - } - virtual OfaRefItem<reference_type>* Clone( SfxItemPool* /*pPool = 0*/ ) const override - { - return new OfaRefItem( *this ); - } + OfaXColorListItem( sal_uInt16 _nWhich, const rtl::Reference<XColorList> &xRef ); + + virtual bool operator==( const SfxPoolItem& rItem ) const override; + + virtual OfaXColorListItem* Clone( SfxItemPool *pPool = nullptr ) const override; }; #endif diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index a88beea11421..fb974d2af8b4 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -25,6 +25,7 @@ #include <svl/typedwhich.hxx> class OfaPtrItem; +class OfaXColorListItem; class SdrAngleItem; class SfxBoolItem; class SfxInt32Item; @@ -517,7 +518,7 @@ class XFillGradientItem; #define SID_SM_EDITOPTIONS ( SID_SVX_START + 436 ) #define SID_SCH_EDITOPTIONS TypedWhichId<SvxChartColorTableItem>( SID_SVX_START + 437 ) #define SID_SW_ONLINEOPTIONS ( SID_SVX_START + 439 ) -#define SID_GET_COLORLIST ( SID_SVX_START + 441 ) +#define SID_GET_COLORLIST TypedWhichId<OfaXColorListItem>( SID_SVX_START + 441 ) #define SID_OUTLINE_TO_IMPRESS ( SID_SVX_START + 443 ) #define SID_SPELLCHECKER_CHANGED ( SID_SVX_START + 446 ) #define SID_SD_GRAPHIC_OPTIONS ( SID_SVX_START + 447 ) diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index a97a47ecc6ec..dd1943620193 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -621,7 +621,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) { const SvxColorListItem* pColItem = GetItem(SID_COLOR_TABLE); const XColorListRef& pList = pColItem->GetColorList(); - rReq.SetReturnValue(OfaRefItem<XColorList>(SID_GET_COLORLIST, pList)); + rReq.SetReturnValue(OfaXColorListItem(SID_GET_COLORLIST, pList)); } break; diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index 1a9e70833d5f..be045818a67a 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -245,7 +245,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) { const SvxColorListItem* pColItem = GetItem( SID_COLOR_TABLE ); const XColorListRef& pList = pColItem->GetColorList(); - rReq.SetReturnValue( OfaRefItem<XColorList>( SID_GET_COLORLIST, pList ) ); + rReq.SetReturnValue( OfaXColorListItem( SID_GET_COLORLIST, pList ) ); } break; diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index 599fcd0a0010..a0c971c0c878 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -362,7 +362,7 @@ // class SvxHyperlinkItem : public SfxPoolItem // class SvxNumberInfoItem : public SfxPoolItem // class OfaPtrItem : public SfxPoolItem -// class OfaRefItem : public SfxPoolItem +// class OfaXColorListItem : public SfxPoolItem // class SvxGridItem : public SvxOptionsGrid, public SfxPoolItem // class SdOptionsGridItem : public SvxGridItem // class SvxPageItem: public SfxPoolItem diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index 549ffc3f3227..a7d376130539 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -196,7 +196,7 @@ item INT32 SdrAngleItem; // derived from SfxInt32Item item INT16 SdrTextFitToSizeTypeItem; // enum item String SfxStringListItem; // serialized into one concatenated string item double SvxDoubleItem; -item String OfaRefItem; +item String OfaXColorListItem; item String SvxDashListItem; item String SvxLineEndListItem; item String SvxColorListItem; diff --git a/svx/source/items/ofaitem.cxx b/svx/source/items/ofaitem.cxx index 3bffd661ed0f..688507592b40 100644 --- a/svx/source/items/ofaitem.cxx +++ b/svx/source/items/ofaitem.cxx @@ -19,6 +19,7 @@ #include <svx/ofaitem.hxx> +#include <svx/xtable.hxx> OfaPtrItem::OfaPtrItem( sal_uInt16 _nWhich, void *_pPtr ) : SfxPoolItem( _nWhich ), pPtr( _pPtr ) @@ -37,4 +38,19 @@ OfaPtrItem* OfaPtrItem::Clone( SfxItemPool * ) const return new OfaPtrItem( *this ); } +OfaXColorListItem::OfaXColorListItem( sal_uInt16 _nWhich, const rtl::Reference<XColorList> &xRef ) + : SfxPoolItem( _nWhich ), mxRef( xRef ) +{} + +bool OfaXColorListItem::operator==( const SfxPoolItem& rItem ) const +{ + return SfxPoolItem::operator==(rItem) + && mxRef == static_cast<OfaXColorListItem const &>(rItem).mxRef; +} + +OfaXColorListItem* OfaXColorListItem::Clone( SfxItemPool* /*pPool = 0*/ ) const +{ + return new OfaXColorListItem( *this ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 415c30d4d296..9e606f0b4095 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -739,7 +739,7 @@ void SwDocShell::Execute(SfxRequest& rReq) { const SvxColorListItem* pColItem = GetItem(SID_COLOR_TABLE); const XColorListRef& pList = pColItem->GetColorList(); - rReq.SetReturnValue(OfaRefItem<XColorList>(SID_GET_COLORLIST, pList)); + rReq.SetReturnValue(OfaXColorListItem(SID_GET_COLORLIST, pList)); } break; case FN_ABSTRACT_STARIMPRESS: |