summaryrefslogtreecommitdiff
path: root/svl/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-04-13 16:01:31 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-04-15 11:35:35 +0000
commitfe73ed7c79b96eaa5aa84314a07ae11f188575a1 (patch)
treec31e19b767338e15afd51606753b822bdd5b700d /svl/source
parentd208cf834f4f191558ae27ea7a8c7a31b8e440a6 (diff)
convert SFX_ITEM constants to scoped enum
Change-Id: Ief8c30c356ba947727c5ab70092042816a0db99e Reviewed-on: https://gerrit.libreoffice.org/15302 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svl/source')
-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
4 files changed, 19 insertions, 20 deletions
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();