summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svl/aeitem.hxx12
-rw-r--r--include/svl/cenumitm.hxx12
-rw-r--r--svl/source/items/aeitem.cxx13
-rw-r--r--svl/source/items/cenumitm.cxx10
4 files changed, 11 insertions, 36 deletions
diff --git a/include/svl/aeitem.hxx b/include/svl/aeitem.hxx
index 961737922047..fb9125ee1443 100644
--- a/include/svl/aeitem.hxx
+++ b/include/svl/aeitem.hxx
@@ -31,11 +31,11 @@ class SVL_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem
SfxAllEnumValueArr* pValues;
std::vector<sal_uInt16>* pDisabledValues;
-protected:
- sal_uInt16 GetPosByValue_( sal_uInt16 nValue ) const;
+ sal_uInt16 GetPosByValue( sal_uInt16 nValue ) const;
+ sal_uInt16 GetPosByValue_( sal_uInt16 nValue ) const;
public:
- static SfxPoolItem* CreateDefault();
+ static SfxPoolItem* CreateDefault();
SfxAllEnumItem();
explicit SfxAllEnumItem( sal_uInt16 nWhich);
@@ -48,14 +48,12 @@ public:
void InsertValue( sal_uInt16 nValue, const OUString &rText );
void RemoveValue( sal_uInt16 nValue );
- sal_uInt16 GetPosByValue( sal_uInt16 nValue ) const override;
-
virtual sal_uInt16 GetValueCount() const override;
virtual sal_uInt16 GetValueByPos( sal_uInt16 nPos ) const override;
- virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const override;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const override;
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVersion) const override;
- virtual bool IsEnabled( sal_uInt16 ) const override;
+ virtual bool IsEnabled( sal_uInt16 ) const override;
void DisableValue( sal_uInt16 );
};
diff --git a/include/svl/cenumitm.hxx b/include/svl/cenumitm.hxx
index 2bbe74036c17..72e6ed65afa0 100644
--- a/include/svl/cenumitm.hxx
+++ b/include/svl/cenumitm.hxx
@@ -49,18 +49,6 @@ public:
virtual sal_uInt16 GetValueByPos(sal_uInt16 nPos) const;
- /// Return the position of some value within this enumeration.
- ///
- /// @descr This method is implemented using GetValueCount() and
- /// GetValueByPos(). Derived classes may replace this with a more
- /// efficient implementation.
- ///
- /// @param nValue Some value.
- ///
- /// @return The position of nValue within this enumeration, or USHRT_MAX
- /// if not included.
- virtual sal_uInt16 GetPosByValue(sal_uInt16 nValue) const;
-
virtual bool IsEnabled(sal_uInt16 nValue) const;
virtual sal_uInt16 GetEnumValue() const = 0;
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;