From 705574be7ab3425ce7e43b38771b4f7e1b246f27 Mon Sep 17 00:00:00 2001 From: Jochen Nitschke Date: Wed, 31 Aug 2016 19:58:14 +0200 Subject: use SfxItemPool::IsWhich instead of custom implementation Change-Id: I56cbdc1ede491486643f73a98117c5cd4ce77c1d Reviewed-on: https://gerrit.libreoffice.org/28564 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svl/source/items/itemprop.cxx | 4 ++-- svl/source/items/itemset.cxx | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'svl') diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx index 5e2a7279e1e4..c3ec9b69cec3 100644 --- a/svl/source/items/itemprop.cxx +++ b/svl/source/items/itemprop.cxx @@ -180,7 +180,7 @@ void SfxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry& rEn // get the SfxPoolItem const SfxPoolItem* pItem = nullptr; SfxItemState eState = rSet.GetItemState( rEntry.nWID, true, &pItem ); - if(SfxItemState::SET != eState && SFX_WHICH_MAX > rEntry.nWID ) + if (SfxItemState::SET != eState && SfxItemPool::IsWhich(rEntry.nWID) ) pItem = &rSet.GetPool()->GetDefaultItem(rEntry.nWID); // return item values as uno::Any if(eState >= SfxItemState::DEFAULT && pItem) @@ -235,7 +235,7 @@ void SfxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry& rEn const SfxPoolItem* pItem = nullptr; std::unique_ptr pNewItem; SfxItemState eState = rSet.GetItemState( rEntry.nWID, true, &pItem ); - if(SfxItemState::SET != eState && SFX_WHICH_MAX > rEntry.nWID ) + if (SfxItemState::SET != eState && SfxItemPool::IsWhich(rEntry.nWID)) pItem = &rSet.GetPool()->GetDefaultItem(rEntry.nWID); //maybe there's another way to find an Item if(eState < SfxItemState::DEFAULT) diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index d55f9c504753..ceb3f2764fa1 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -258,7 +258,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) if ( !IsInvalidItem(pItemToClear) ) { - if ( nWhich <= SFX_WHICH_MAX ) + if (SfxItemPool::IsWhich(nWhich)) { const SfxPoolItem& rNew = m_pParent ? m_pParent->Get( nWhich ) @@ -296,7 +296,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich ) if ( !IsInvalidItem(pItemToClear) ) { - if ( nWhich <= SFX_WHICH_MAX ) + if (SfxItemPool::IsWhich(nWhich)) { const SfxPoolItem& rNew = m_pParent ? m_pParent->Get( nWhich ) @@ -453,7 +453,7 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich const SfxPoolItem& rNew = m_pPool->Put( rItem, nWhich ); const SfxPoolItem* pOld = *ppFnd; *ppFnd = &rNew; - if(nWhich <= SFX_WHICH_MAX) + if (SfxItemPool::IsWhich(nWhich)) Changed( *pOld, rNew ); m_pPool->Remove( *pOld ); } @@ -466,7 +466,7 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich else { const SfxPoolItem& rNew = m_pPool->Put( rItem, nWhich ); *ppFnd = &rNew; - if (nWhich <= SFX_WHICH_MAX ) + if (SfxItemPool::IsWhich(nWhich)) { const SfxPoolItem& rOld = m_pParent ? m_pParent->Get( nWhich ) @@ -766,7 +766,7 @@ const SfxPoolItem* SfxItemSet::GetItem(sal_uInt16 nId, bool bSearchInParent) con // Is the Item set or 'bDeep == true' available? const SfxPoolItem *pItem = nullptr; SfxItemState eState = GetItemState(nWhich, bSearchInParent, &pItem); - if (bSearchInParent && SfxItemState::DEFAULT == eState && nWhich <= SFX_WHICH_MAX) + if (bSearchInParent && SfxItemState::DEFAULT == eState && SfxItemPool::IsWhich(nWhich)) { pItem = &m_pPool->GetDefaultItem(nWhich); } @@ -888,7 +888,7 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet ) if( !IsInvalidItem( *ppFnd1 ) ) { sal_uInt16 nWhich = (*ppFnd1)->Which(); - if(nWhich <= SFX_WHICH_MAX) + if (SfxItemPool::IsWhich(nWhich)) { const SfxPoolItem& rNew = m_pParent ? m_pParent->Get( nWhich ) @@ -954,7 +954,7 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet ) if( !IsInvalidItem( *ppFnd1 ) ) { sal_uInt16 nWhich = (*ppFnd1)->Which(); - if(nWhich <= SFX_WHICH_MAX) + if (SfxItemPool::IsWhich(nWhich)) { const SfxPoolItem& rNew = m_pParent ? m_pParent->Get( nWhich ) @@ -1717,7 +1717,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi bIncrementCount = true; pOld = (m_pParent) ? &m_pParent->Get( nWhich ) - : ((nWhich <= SFX_WHICH_MAX) + : (SfxItemPool::IsWhich(nWhich) ? &m_pPool->GetDefaultItem(nWhich) : nullptr); } -- cgit