[Libreoffice-commits] core.git: include/svl svl/source
Noel Grandin
noel.grandin at collabora.co.uk
Wed Jan 25 07:10:46 UTC 2017
include/svl/aeitem.hxx | 12 +++++-------
include/svl/cenumitm.hxx | 12 ------------
svl/source/items/aeitem.cxx | 13 ++++++-------
svl/source/items/cenumitm.cxx | 10 ----------
4 files changed, 11 insertions(+), 36 deletions(-)
New commits:
commit 96def52140ddcf7f72afb4362567f60425fa9f16
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Jan 24 14:44:56 2017 +0200
move GetPosByValue from SfxEnumItemInterface to SfxAllEnumItem
which is it's only use-site
Change-Id: I35943282ad4f5fd5ad297831d63e8abee9a2ddff
diff --git a/include/svl/aeitem.hxx b/include/svl/aeitem.hxx
index 9617379..fb9125e 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 2bbe740..72e6ed6 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 6ad2c76..7f17698 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 033b6a6..55d3fbe 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;
More information about the Libreoffice-commits
mailing list