[Libreoffice-commits] core.git: editeng/source svl/source svx/source sw/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Thu Sep 1 06:47:09 UTC 2016


 editeng/source/rtf/svxrtf.cxx      |    4 ++--
 svl/source/items/itemprop.cxx      |    4 ++--
 svl/source/items/itemset.cxx       |   16 ++++++++--------
 svx/source/dialog/hdft.cxx         |    2 +-
 sw/source/core/unocore/unosect.cxx |    4 ++--
 sw/source/filter/xml/xmlexpit.cxx  |    2 +-
 sw/source/filter/xml/xmlimpit.cxx  |    2 +-
 sw/source/filter/xml/xmlitemi.cxx  |    2 +-
 8 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 705574be7ab3425ce7e43b38771b4f7e1b246f27
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Wed Aug 31 19:58:14 2016 +0200

    use SfxItemPool::IsWhich instead of custom implementation
    
    Change-Id: I56cbdc1ede491486643f73a98117c5cd4ce77c1d
    Reviewed-on: https://gerrit.libreoffice.org/28564
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index a81713f..8c40e4b 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -825,7 +825,7 @@ void SvxRTFParser::ClearStyleAttr_( SvxRTFItemStackType& rStkType )
     {
         for( sal_uInt16 nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() )
         {
-            if( SFX_WHICH_MAX > nWhich &&
+            if (SfxItemPool::IsWhich(nWhich) &&
                 SfxItemState::SET == rSet.GetItemState( nWhich, false, &pItem ) &&
                      rPool.GetDefaultItem( nWhich ) == *pItem )
                 rSet.ClearItem( nWhich );       // delete
@@ -846,7 +846,7 @@ void SvxRTFParser::ClearStyleAttr_( SvxRTFItemStackType& rStkType )
                     && *pItem == *pSItem )
                     rSet.ClearItem( nWhich );       // delete
             }
-            else if( SFX_WHICH_MAX > nWhich &&
+            else if (SfxItemPool::IsWhich(nWhich) &&
                     SfxItemState::SET == rSet.GetItemState( nWhich, false, &pItem ) &&
                      rPool.GetDefaultItem( nWhich ) == *pItem )
                 rSet.ClearItem( nWhich );       // delete
diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx
index 5e2a727..c3ec9b6 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<SfxPoolItem> 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 d55f9c5..ceb3f27 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);
     }
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 318ae32..55b2094 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -277,7 +277,7 @@ bool SvxHFPage::FillItemSet( SfxItemSet* rSet )
     aSet.Put( SfxBoolItem( nWShared,  m_pCntSharedBox->IsChecked() ) );
     if(m_pCntSharedFirstBox->IsVisible())
         aSet.Put( SfxBoolItem( nWSharedFirst,  m_pCntSharedFirstBox->IsChecked() ) );
-    if(m_pDynSpacingCB->IsVisible() && SFX_WHICH_MAX > nWDynSpacing)
+    if (m_pDynSpacingCB->IsVisible() && SfxItemPool::IsWhich(nWDynSpacing))
     {
         std::unique_ptr<SfxBoolItem> pBoolItem(static_cast<SfxBoolItem*>(pPool->GetDefaultItem(nWDynSpacing).Clone()));
         pBoolItem->SetValue(m_pDynSpacingCB->IsChecked());
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 64ffaeb..39b2dda 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -1563,7 +1563,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
         break;
         default:
         {
-            if (pEntry->nWID <= SFX_WHICH_MAX)
+            if (SfxItemPool::IsWhich(pEntry->nWID))
             {
                 if (pFormat)
                 {
@@ -1634,7 +1634,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
             ::sw::GetDefaultTextContentValue(aRet, OUString(), pEntry->nWID);
         break;
         default:
-        if(pFormat && pEntry->nWID <= SFX_WHICH_MAX)
+        if(pFormat && SfxItemPool::IsWhich(pEntry->nWID))
         {
             SwDoc *const pDoc = pFormat->GetDoc();
             const SfxPoolItem& rDefItem =
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index a721d6c..6c96f8b 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -267,7 +267,7 @@ const SfxPoolItem* SvXMLExportItemMapper::GetItem( const SfxItemSet& rSet,
         return pItem;
     }
     else if( (nFlags & SvXmlExportFlags::DEFAULTS) &&
-              SFX_WHICH_MAX > nWhichId )
+              SfxItemPool::IsWhich(nWhichId))
     {
         // if its not set, try the pool if we export defaults
         return &rSet.GetPool()->GetDefaultItem(nWhichId);
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx
index 340e1a0..e7a356b 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -110,7 +110,7 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet,
                                                          &pItem );
 
                 // if its not set, try the pool
-                if(SfxItemState::SET != eState && SFX_WHICH_MAX > pEntry->nWhichId )
+                if (SfxItemState::SET != eState && SfxItemPool::IsWhich(pEntry->nWhichId))
                     pItem = &rSet.GetPool()->GetDefaultItem(pEntry->nWhichId);
 
                 // do we have an item?
diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx
index 9160dd2..e5b1d58 100644
--- a/sw/source/filter/xml/xmlitemi.cxx
+++ b/sw/source/filter/xml/xmlitemi.cxx
@@ -217,7 +217,7 @@ void SwXMLImportTableItemMapper_Impl::finished(
                 rSet.GetItemState(Ids[i][0], true, &pItem);
 
             // if not set, try the pool
-            if ((SfxItemState::SET != eState) && (SFX_WHICH_MAX > Ids[i][0]))
+            if ((SfxItemState::SET != eState) && SfxItemPool::IsWhich(Ids[i][0]))
             {
                 pItem = &rSet.GetPool()->GetDefaultItem(Ids[i][0]);
             }


More information about the Libreoffice-commits mailing list