summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-07-22 13:09:24 +0200
committerNoel Grandin <noel@peralex.com>2014-07-23 13:26:18 +0200
commit8497efb425d901257464a03e7c5faa3f1bbea9fe (patch)
tree5cc2e57b1a15e55a11fc933e33b96d81547fd91a /include
parentb78d881520f2eb658180e2c90ffee3d30a80f0ae (diff)
convert SfxPoolItem kind constants to an enum
Change-Id: I57de8c0cebfd60fdf70c23c72ecf1e47c69d7ecd
Diffstat (limited to 'include')
-rw-r--r--include/svl/itempool.hxx4
-rw-r--r--include/svl/poolitem.hxx29
2 files changed, 18 insertions, 15 deletions
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
index 3fd8450c9de8..09c1305dd142 100644
--- a/include/svl/itempool.hxx
+++ b/include/svl/itempool.hxx
@@ -89,7 +89,7 @@ protected:
static inline void SetRefCount( SfxPoolItem& rItem, sal_uLong n );
static inline void AddRef( const SfxPoolItem& rItem, sal_uLong n = 1 );
static inline sal_uLong ReleaseRef( const SfxPoolItem& rItem, sal_uLong n = 1);
- static inline void SetKind( SfxPoolItem& rItem, sal_uInt16 nRef );
+ static inline void SetKind( SfxPoolItem& rItem, SfxItemKind nRef );
public:
SfxItemPool( const SfxItemPool &rPool,
@@ -238,7 +238,7 @@ inline sal_uLong SfxItemPool::ReleaseRef( const SfxPoolItem& rItem, sal_uLong n
return rItem.ReleaseRef(n);
}
-inline void SfxItemPool::SetKind( SfxPoolItem& rItem, sal_uInt16 nRef )
+inline void SfxItemPool::SetKind( SfxPoolItem& rItem, SfxItemKind nRef )
{
rItem.SetKind( nRef );
}
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
index 698fe6ea3854..ce916507b084 100644
--- a/include/svl/poolitem.hxx
+++ b/include/svl/poolitem.hxx
@@ -39,13 +39,16 @@ class IntlWrapper;
namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
-static const sal_uInt32 SFX_ITEMS_DIRECT= 0xffffffff;
-static const sal_uInt32 SFX_ITEMS_NULL= 0xfffffff0; // instead StoreSurrogate
-static const sal_uInt32 SFX_ITEMS_DEFAULT= 0xfffffffe;
-
-#define SFX_ITEMS_POOLDEFAULT 0xffff
-#define SFX_ITEMS_STATICDEFAULT 0xfffe
-#define SFX_ITEMS_DELETEONIDLE 0xfffd
+static const sal_uInt32 SFX_ITEMS_DIRECT = 0xffffffff;
+static const sal_uInt32 SFX_ITEMS_NULL = 0xfffffff0; // instead StoreSurrogate
+static const sal_uInt32 SFX_ITEMS_DEFAULT = 0xfffffffe;
+
+enum SfxItemKind {
+ SFX_ITEMS_NONE,
+ SFX_ITEMS_DELETEONIDLE,
+ SFX_ITEMS_STATICDEFAULT,
+ SFX_ITEMS_POOLDEFAULT
+};
#define SFX_ITEMS_OLD_MAXREF 0xffef
#define SFX_ITEMS_MAXREF 0xfffffffe
@@ -162,11 +165,11 @@ friend class SfxVoidItem;
mutable sal_uLong m_nRefCount;
sal_uInt16 m_nWhich;
- sal_uInt16 m_nKind;
+ SfxItemKind m_nKind;
private:
inline void SetRefCount( sal_uLong n );
- inline void SetKind( sal_uInt16 n );
+ inline void SetKind( SfxItemKind n );
public:
inline void AddRef( sal_uLong n = 1 ) const;
private:
@@ -206,7 +209,7 @@ public:
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const = 0;
sal_uLong GetRefCount() const { return m_nRefCount; }
- inline sal_uInt16 GetKind() const { return m_nKind; }
+ inline SfxItemKind GetKind() const { return m_nKind; }
/** Read in a Unicode string from a streamed byte string representation.
@@ -259,10 +262,10 @@ private:
inline void SfxPoolItem::SetRefCount( sal_uLong n )
{
m_nRefCount = n;
- m_nKind = 0;
+ m_nKind = SFX_ITEMS_NONE;
}
-inline void SfxPoolItem::SetKind( sal_uInt16 n )
+inline void SfxPoolItem::SetKind( SfxItemKind n )
{
m_nRefCount = SFX_ITEMS_SPECIAL;
m_nKind = n;
@@ -297,7 +300,7 @@ inline bool IsStaticDefaultItem(const SfxPoolItem *pItem )
inline bool IsDefaultItem( const SfxPoolItem *pItem )
{
- return pItem && pItem->GetKind() >= SFX_ITEMS_STATICDEFAULT;
+ return pItem && (pItem->GetKind() == SFX_ITEMS_STATICDEFAULT || pItem->GetKind() == SFX_ITEMS_POOLDEFAULT);
}
inline bool IsPooledItem( const SfxPoolItem *pItem )