summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
Diffstat (limited to 'svl')
-rw-r--r--svl/README2
-rw-r--r--svl/qa/unit/items/test_itempool.cxx8
-rw-r--r--svl/source/items/itempool.cxx19
-rw-r--r--svl/source/items/itemset.cxx10
-rw-r--r--svl/source/items/poolio.cxx6
-rw-r--r--svl/source/items/stylepool.cxx4
6 files changed, 24 insertions, 25 deletions
diff --git a/svl/README b/svl/README
index 2665c1a987ce..57cb60ce8d19 100644
--- a/svl/README
+++ b/svl/README
@@ -19,7 +19,7 @@ A small reference counted piece of data. Many subclasses, each with a
unique integer to identify its type (WhichId). Can be compared for equality
(operator==), Clone()d, and converted to/from uno::Any (QueryValue/PutValue).
-A pool item may have value semantics (SFX_ITEM_POOLABLE), meaning that
+A pool item may have value semantics (SfxItemPoolFlags::POOLABLE), meaning that
there will generally be only one instance that compares equal per item pool,
or not, in which case the item will be Clone()d quite a bit.
diff --git a/svl/qa/unit/items/test_itempool.cxx b/svl/qa/unit/items/test_itempool.cxx
index 469287eecc83..f42ee3fec23e 100644
--- a/svl/qa/unit/items/test_itempool.cxx
+++ b/svl/qa/unit/items/test_itempool.cxx
@@ -35,10 +35,10 @@ class PoolItemTest : public CppUnit::TestFixture
void PoolItemTest::testPool()
{
SfxItemInfo aItems[] =
- { { 0, SFX_ITEM_POOLABLE },
- { 1, 0 /* not poolable */ },
- { 2, SFX_ITEM_NOT_POOLABLE },
- { 3, 0 /* not poolable */}
+ { { 0, SfxItemPoolFlags::POOLABLE },
+ { 1, SfxItemPoolFlags::NONE /* not poolable */ },
+ { 2, SfxItemPoolFlags::NOT_POOLABLE },
+ { 3, SfxItemPoolFlags::NONE /* not poolable */}
};
SfxItemPool *pPool = new SfxItemPool("testpool", 0, 3, aItems);
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 61579617261c..b92e0bae185d 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -114,15 +114,14 @@ const SfxPoolItem* SfxItemPool::GetPoolDefaultItem( sal_uInt16 nWhich ) const
-bool SfxItemPool::IsItemFlag_Impl( sal_uInt16 nPos, sal_uInt16 nFlag ) const
+bool SfxItemPool::IsItemFlag_Impl( sal_uInt16 nPos, SfxItemPoolFlags nFlag ) const
{
- sal_uInt16 nItemFlag = pItemInfos[nPos]._nFlags;
- return nFlag == (nItemFlag & nFlag);
+ return bool(pItemInfos[nPos]._nFlags & nFlag);
}
-bool SfxItemPool::IsItemFlag( sal_uInt16 nWhich, sal_uInt16 nFlag ) const
+bool SfxItemPool::IsItemFlag( sal_uInt16 nWhich, SfxItemPoolFlags nFlag ) const
{
for ( const SfxItemPool *pPool = this; pPool; pPool = pPool->pImp->mpSecondary )
{
@@ -154,7 +153,7 @@ SfxBroadcaster& SfxItemPool::BC()
* 'pItemInfos' is a USHORT array arranged in the same way, which holds
* SlotIds and Flags. These SlotIds can be 0, if the affected Items are
* exclusively used in the Core.
- * The flags allow for e.g. enabling value sharing (SFX_ITEM_POOLABLE).
+ * The flags allow for e.g. enabling value sharing (SfxItemPoolFlags::POOLABLE).
*
* If the Pool is supposed to hold SfxSetItems, the ctor cannot yet contain
* static Defaults. This needs to be done afterwards, using
@@ -657,7 +656,7 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
// SID or not poolable (new definition)?
sal_uInt16 nIndex = bSID ? USHRT_MAX : GetIndex_Impl(nWhich);
if ( USHRT_MAX == nIndex ||
- IsItemFlag_Impl( nIndex, SFX_ITEM_NOT_POOLABLE ) )
+ IsItemFlag_Impl( nIndex, SfxItemPoolFlags::NOT_POOLABLE ) )
{
SFX_ASSERT( USHRT_MAX != nIndex || rItem.Which() != nWhich ||
!IsDefaultItem(&rItem) || rItem.GetKind() == SFX_ITEMS_DELETEONIDLE,
@@ -684,7 +683,7 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
// Is this a 'poolable' item - ie. should we re-use and return
// the same underlying item for equivalent (==) SfxPoolItems?
- if ( IsItemFlag_Impl( nIndex, SFX_ITEM_POOLABLE ) )
+ if ( IsItemFlag_Impl( nIndex, SfxItemPoolFlags::POOLABLE ) )
{
// if is already in a pool, then it is worth checking if it is in this one.
if ( IsPooledItem(&rItem) )
@@ -745,10 +744,10 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
SFX_ASSERT( rItem.Type() == pNewItem->Type(), nWhich, "unequal types in Put(): no Clone()?" )
if ( !rItem.ISA(SfxSetItem) )
{
- SFX_ASSERT( !IsItemFlag(nWhich, SFX_ITEM_POOLABLE) ||
+ SFX_ASSERT( !IsItemFlag(nWhich, SfxItemPoolFlags::POOLABLE) ||
rItem == *pNewItem,
nWhich, "unequal items in Put(): no operator==?" );
- SFX_ASSERT( !IsItemFlag(*pNewItem, SFX_ITEM_POOLABLE) ||
+ SFX_ASSERT( !IsItemFlag(*pNewItem, SfxItemPoolFlags::POOLABLE) ||
*pNewItem == rItem,
nWhich, "unequal items in Put(): no operator==?" );
}
@@ -812,7 +811,7 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
// SID or not poolable (new definition)?
sal_uInt16 nIndex = bSID ? USHRT_MAX : GetIndex_Impl(nWhich);
- if ( bSID || IsItemFlag_Impl( nIndex, SFX_ITEM_NOT_POOLABLE ) )
+ if ( bSID || IsItemFlag_Impl( nIndex, SfxItemPoolFlags::NOT_POOLABLE ) )
{
SFX_ASSERT( USHRT_MAX != nIndex ||
!IsDefaultItem(&rItem), rItem.Which(),
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 22e4318672c4..018a6ae25b0a 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -60,7 +60,7 @@ const sal_Char *DbgCheckItemSet( const void* pVoid )
) && "SfxItemSet: invalid which-id" );
assert((IsInvalidItem(pItem) || !pItem->Which() ||
!SfxItemPool::IsWhich(pItem->Which()) ||
- pSet->GetPool()->IsItemFlag(nWh, SFX_ITEM_NOT_POOLABLE) ||
+ pSet->GetPool()->IsItemFlag(nWh, SfxItemPoolFlags::NOT_POOLABLE) ||
SFX_ITEMS_NULL != pSet->GetPool()->GetSurrogate(pItem)
) && "SfxItemSet: item in set which is not in pool" );
}
@@ -215,7 +215,7 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet )
IsStaticDefaultItem(*ppSrc) ) // Defaults that are not to be pooled?
// Just copy the pointer
*ppDst = *ppSrc;
- else if (m_pPool->IsItemFlag( **ppSrc, SFX_ITEM_POOLABLE ))
+ else if (m_pPool->IsItemFlag( **ppSrc, SfxItemPoolFlags::POOLABLE ))
{
// Just copy the pointer and increase RefCount
*ppDst = *ppSrc;
@@ -529,7 +529,7 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
}
}
}
- SFX_ASSERT( !m_pPool->IsItemFlag(nWhich, SFX_ITEM_POOLABLE) ||
+ SFX_ASSERT( !m_pPool->IsItemFlag(nWhich, SfxItemPoolFlags::POOLABLE) ||
rItem.ISA(SfxSetItem) || **ppFnd == rItem,
nWhich, "putted Item unequal" );
return *ppFnd;
@@ -1503,7 +1503,7 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
rCmp.GetItemState( nWh, false, &pItem2 ) ||
( pItem1 != pItem2 &&
( !pItem1 || IsInvalidItem(pItem1) ||
- (m_pPool->IsItemFlag(*pItem1, SFX_ITEM_POOLABLE) &&
+ (m_pPool->IsItemFlag(*pItem1, SfxItemPoolFlags::POOLABLE) &&
*pItem1 != *pItem2 ) ) ) )
return false;
}
@@ -1526,7 +1526,7 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
if ( *ppItem1 != *ppItem2 &&
( ( !*ppItem1 || !*ppItem2 ) ||
( IsInvalidItem(*ppItem1) || IsInvalidItem(*ppItem2) ) ||
- (m_pPool->IsItemFlag(**ppItem1, SFX_ITEM_POOLABLE)) ||
+ (m_pPool->IsItemFlag(**ppItem1, SfxItemPoolFlags::POOLABLE)) ||
**ppItem1 != **ppItem2 ) )
return false;
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index 046503691784..b9b89de178c9 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -198,7 +198,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
// ! Poolable is not even saved in the Pool
// And itemsets/plain-items depending on the round
- if ( *itrArr && IsItemFlag(**ppDefItem, SFX_ITEM_POOLABLE) &&
+ if ( *itrArr && IsItemFlag(**ppDefItem, SfxItemPoolFlags::POOLABLE) &&
pImp->bInSetItem == (bool) (*ppDefItem)->ISA(SfxSetItem) )
{
// Own signature, global WhichId and ItemVersion
@@ -720,7 +720,7 @@ sal_uInt16 SfxItemPool::GetSize_Impl() const
* Loads surrogate from 'rStream' and returns the corresponding SfxPoolItem
* from the rRefPool.
* If the surrogate contained within the stream == SFX_ITEMS_DIRECT
- * (!SFX_ITEM_POOLABLE), we return 0 and the Item is to be loaded directly
+ * (!SfxItemPoolFlags::POOLABLE), we return 0 and the Item is to be loaded directly
* from the stream.
* We also return 0 for 0xfffffff0 (SFX_ITEMS_NULL) and rWhich is set to 0,
* making the Items unavailable.
@@ -852,7 +852,7 @@ bool SfxItemPool::StoreSurrogate ( SvStream& rStream, const SfxPoolItem* pItem)
{
if ( pItem )
{
- bool bRealSurrogate = IsItemFlag(*pItem, SFX_ITEM_POOLABLE);
+ bool bRealSurrogate = IsItemFlag(*pItem, SfxItemPoolFlags::POOLABLE);
rStream.WriteUInt32( bRealSurrogate
? GetSurrogate( pItem )
: SFX_ITEMS_DIRECT );
diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx
index 1471b8844dba..301572d03579 100644
--- a/svl/source/items/stylepool.cxx
+++ b/svl/source/items/stylepool.cxx
@@ -405,7 +405,7 @@ StylePool::SfxItemSet_Pointer_t StylePoolImpl::insertItemSet( const SfxItemSet&
}
while( pItem )
{
- if( !rSet.GetPool()->IsItemFlag(pItem->Which(), SFX_ITEM_POOLABLE ) )
+ if( !rSet.GetPool()->IsItemFlag(pItem->Which(), SfxItemPoolFlags::POOLABLE ) )
bNonPoolable = true;
if ( !xFoundIgnorableItems.get() ||
( xFoundIgnorableItems.get() &&
@@ -422,7 +422,7 @@ StylePool::SfxItemSet_Pointer_t StylePoolImpl::insertItemSet( const SfxItemSet&
pItem = aIgnorableItemsIter.GetCurItem();
while( pItem )
{
- if( !rSet.GetPool()->IsItemFlag(pItem->Which(), SFX_ITEM_POOLABLE ) )
+ if( !rSet.GetPool()->IsItemFlag(pItem->Which(), SfxItemPoolFlags::POOLABLE ) )
bNonPoolable = true;
pCurNode = pCurNode->findChildNode( *pItem, true );
pItem = aIgnorableItemsIter.NextItem();