diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-24 14:44:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-25 09:10:13 +0200 |
commit | 96def52140ddcf7f72afb4362567f60425fa9f16 (patch) | |
tree | e842a9b714bf25c0f51952852b8db0a0e53e5aa8 /svl | |
parent | 857b403f78c3b2428ea357fe2d1c69522087f3f7 (diff) |
move GetPosByValue from SfxEnumItemInterface to SfxAllEnumItem
which is it's only use-site
Change-Id: I35943282ad4f5fd5ad297831d63e8abee9a2ddff
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/aeitem.cxx | 13 | ||||
-rw-r--r-- | svl/source/items/cenumitm.cxx | 10 |
2 files changed, 6 insertions, 17 deletions
diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx index 6ad2c764b1cd..7f17698eb62a 100644 --- a/svl/source/items/aeitem.cxx +++ b/svl/source/items/aeitem.cxx @@ -114,7 +114,7 @@ SfxPoolItem* SfxAllEnumItem::Create( SvStream & rStream, sal_uInt16 ) const } /** - * In contrast to @see SfxEnumItemInterface::GetPosByValue(sal_uInt16) const + * In contrast to @see GetPosByValue(sal_uInt16) const * this internal method returns the position the value would be for non-present values. */ sal_uInt16 SfxAllEnumItem::GetPosByValue_( sal_uInt16 nVal ) const @@ -130,17 +130,16 @@ sal_uInt16 SfxAllEnumItem::GetPosByValue_( sal_uInt16 nVal ) const return nPos; } -/** - * In contrast to @see SfxEnumItemInterface::GetPosByValue(sal_uInt16) const - * this method always returns nValue, as long as not at least one value has - * been inserted using the SfxAllEnumItem::InsertValue() methods - */ sal_uInt16 SfxAllEnumItem::GetPosByValue( sal_uInt16 nValue ) const { if ( !pValues || pValues->empty() ) return nValue; - return SfxEnumItem::GetPosByValue( nValue ); + sal_uInt16 nCount = GetValueCount(); + for (sal_uInt16 i = 0; i < nCount; ++i) + if (GetValueByPos(i) == nValue) + return i; + return USHRT_MAX; } void SfxAllEnumItem::InsertValue( sal_uInt16 nValue, const OUString &rValue ) diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx index 033b6a6ae812..55d3fbe3aaf4 100644 --- a/svl/source/items/cenumitm.cxx +++ b/svl/source/items/cenumitm.cxx @@ -80,16 +80,6 @@ sal_uInt16 SfxEnumItemInterface::GetValueByPos(sal_uInt16 nPos) const return nPos; } -// virtual -sal_uInt16 SfxEnumItemInterface::GetPosByValue(sal_uInt16 nValue) const -{ - sal_uInt16 nCount = GetValueCount(); - for (sal_uInt16 i = 0; i < nCount; ++i) - if (GetValueByPos(i) == nValue) - return i; - return USHRT_MAX; -} - bool SfxEnumItemInterface::IsEnabled(sal_uInt16) const { return true; |