summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-10-01 00:21:00 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-10-01 06:35:49 +0200
commit981654f6e0d57c2c6dd1bbf740a6b67941146497 (patch)
treef7cf40ccf38d4666280b647c77ea7859e97f89e4 /sw
parent1fc63383ccd8af144d681ba405f5ead863ac24e1 (diff)
Drop SfxItemIter::FirstItem
It is always used right after the iterator is created, where simple GetCurItem gives the same value without reseting the position. Change-Id: I871dc7989b79e13f06436ef7928692645b5209f6 Reviewed-on: https://gerrit.libreoffice.org/79903 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx2
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx7
-rw-r--r--sw/source/core/doc/docfly.cxx2
-rw-r--r--sw/source/core/doc/docfmt.cxx8
-rw-r--r--sw/source/core/frmedt/fefly1.cxx4
-rw-r--r--sw/source/core/layout/atrfrm.cxx2
-rw-r--r--sw/source/core/text/itratr.cxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx2
-rw-r--r--sw/source/core/txtnode/thints.cxx6
-rw-r--r--sw/source/core/undo/rolbck.cxx12
-rw-r--r--sw/source/core/unocore/unostyle.cxx4
-rw-r--r--sw/source/filter/html/htmlcss1.cxx5
-rw-r--r--sw/source/filter/html/htmlctxt.cxx5
-rw-r--r--sw/source/filter/html/htmldrawreader.cxx4
-rw-r--r--sw/source/uibase/app/docstyle.cxx4
-rw-r--r--sw/source/uibase/wrtsh/wrtsh1.cxx4
16 files changed, 24 insertions, 49 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 3a2296588f03..9292c83ff761 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1115,7 +1115,7 @@ namespace //local functions originally from docfmt.cxx
if ( 1 == rChgSet.Count() )
{
SfxItemIter aIter( rChgSet );
- const SfxPoolItem* pItem = aIter.FirstItem();
+ const SfxPoolItem* pItem = aIter.GetCurItem();
if (pItem && !IsInvalidItem(pItem))
{
const sal_uInt16 nWhich = pItem->Which();
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index afedbfdcc784..1e7a7be92be4 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -251,13 +251,10 @@ const char * dbg_out(const SfxPoolItem * pItem)
static OUString lcl_dbg_out(const SfxItemSet & rSet)
{
SfxItemIter aIter(rSet);
- const SfxPoolItem * pItem;
bool bFirst = true;
OUStringBuffer aStr = "[ ";
- pItem = aIter.FirstItem();
-
- while (pItem )
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
if (!bFirst)
aStr.append(", ");
@@ -268,8 +265,6 @@ static OUString lcl_dbg_out(const SfxItemSet & rSet)
aStr.append("invalid");
bFirst = false;
-
- pItem = aIter.NextItem();
}
aStr.append(" ]");
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 58f4521f94d0..f67d05b572a5 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -492,7 +492,7 @@ void SwDoc::CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet)
SwDrawModel* pDrawModel = getIDocumentDrawModelAccess().GetOrCreateDrawModel();
SfxItemIter aIter(rSet);
- for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem())
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
if (IsInvalidItem(pItem))
continue;
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index c9ca44a6a8d2..83ba56a91948 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1831,8 +1831,7 @@ void SwDoc::SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& rSet
const sal_Int32 nEnd(rPam.End()->nContent.GetIndex());
std::vector<sal_uInt16> whichIds;
SfxItemIter iter(rSet);
- for (SfxPoolItem const* pItem = iter.FirstItem();
- pItem; pItem = iter.NextItem())
+ for (SfxPoolItem const* pItem = iter.GetCurItem(); pItem; pItem = iter.NextItem())
{
whichIds.push_back(pItem->Which());
whichIds.push_back(pItem->Which());
@@ -1875,12 +1874,9 @@ void SwDoc::ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet)
{
SfxItemIter aIter(aSet);
- const SfxPoolItem * pItem = aIter.FirstItem();
- while (pItem != nullptr)
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
aOldSet.InvalidateItem(pItem->Which());
-
- pItem = aIter.NextItem();
}
}
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 622eaf732c76..db4c88897024 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1157,8 +1157,7 @@ void SwFEShell::ResetFlyFrameAttr( const SfxItemSet* pSet )
StartAllAction();
SfxItemIter aIter( *pSet );
- const SfxPoolItem* pItem = aIter.FirstItem();
- while( pItem )
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
if( !IsInvalidItem( pItem ) )
{
@@ -1166,7 +1165,6 @@ void SwFEShell::ResetFlyFrameAttr( const SfxItemSet* pSet )
if( RES_ANCHOR != nWhich && RES_CHAIN != nWhich && RES_CNTNT != nWhich )
pFly->GetFormat()->ResetFormatAttr( nWhich );
}
- pItem = aIter.NextItem();
}
EndAllActionAndCall();
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index b03a2a03b8f7..f657bf55db93 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2519,7 +2519,7 @@ void SwFrameFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
SfxItemIter aIter(*static_cast<const SwAttrSetChg*>(pNew)->GetChgSet());
bool bReset(false);
- for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem())
+ for(const SfxPoolItem* pItem = aIter.GetCurItem(); pItem && !bReset; pItem = aIter.NextItem())
{
bReset = !IsInvalidItem(pItem) && pItem->Which() >= XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST;
}
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index c3e82b4c2f5b..59b7277ff849 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -438,7 +438,7 @@ bool SwAttrIter::Seek(TextFrameIndex const nNewPos)
static void InsertCharAttrs(SfxPoolItem const** pAttrs, SfxItemSet const& rItems)
{
SfxItemIter iter(rItems);
- for (SfxPoolItem const* pItem = iter.FirstItem(); pItem; pItem = iter.NextItem())
+ for (SfxPoolItem const* pItem = iter.GetCurItem(); pItem; pItem = iter.NextItem())
{
auto const nWhich(pItem->Which());
if (isCHRATR(nWhich) && RES_CHRATR_RSID != nWhich)
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 0626058868d0..062343808edd 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -5288,7 +5288,7 @@ void SwTextNode::SwClientNotify( const SwModify& rModify, const SfxHint& rHint )
{
SfxItemIter aIter(*static_cast<const SwAttrSetChg*>(pNewValue)->GetChgSet());
- for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem())
+ for(const SfxPoolItem* pItem = aIter.GetCurItem(); pItem && !bReset; pItem = aIter.NextItem())
{
bReset = !IsInvalidItem(pItem) && pItem->Which() >= XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST;
}
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 84ae91570a1f..79ab2193b5cf 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1786,7 +1786,7 @@ static bool lcl_IsIgnoredCharFormatForBullets(const sal_uInt16 nWhich)
void SwTextNode::TryCharSetExpandToNum(const SfxItemSet& aCharSet)
{
SfxItemIter aIter( aCharSet );
- const SfxPoolItem* pItem = aIter.FirstItem();
+ const SfxPoolItem* pItem = aIter.GetCurItem();
if (!pItem)
return;
const sal_uInt16 nWhich = pItem->Which();
@@ -2766,8 +2766,8 @@ bool SwpHints::MergePortions( SwTextNode& rNode )
SfxItemIter iter2(set2);
if (set1.Count() == set2.Count())
{
- for (SfxPoolItem const* pItem1 = iter1.FirstItem(),
- * pItem2 = iter2.FirstItem();
+ for (SfxPoolItem const* pItem1 = iter1.GetCurItem(),
+ * pItem2 = iter2.GetCurItem();
pItem1 && pItem2;
pItem1 = iter1.NextItem(),
pItem2 = iter2.NextItem())
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 8d30afb1b870..d500679eefee 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -773,8 +773,8 @@ SwHistorySetAttrSet::SwHistorySetAttrSet( const SfxItemSet& rSet,
, m_nNodeIndex( nNodePos )
{
SfxItemIter aIter( m_OldSet ), aOrigIter( rSet );
- const SfxPoolItem* pItem = aIter.FirstItem(),
- * pOrigItem = aOrigIter.FirstItem();
+ const SfxPoolItem* pItem = aIter.GetCurItem(),
+ * pOrigItem = aOrigIter.GetCurItem();
while (pItem && pOrigItem)
{
if( !rSetArr.count( pOrigItem->Which() ))
@@ -1316,7 +1316,7 @@ void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
pNewHstr.reset( new SwHistorySetAttrSet( rSet, m_nNodeIndex, m_WhichIdSet ) );
}
- else if (const SfxPoolItem* pItem = SfxItemIter( rSet ).FirstItem())
+ else if (const SfxPoolItem* pItem = SfxItemIter(rSet).GetCurItem())
{
if ( m_WhichIdSet.count( pItem->Which() ) )
{
@@ -1374,7 +1374,7 @@ bool SwRegHistory::InsertItems( const SfxItemSet& rSet,
if ( m_pHistory && bInserted )
{
SfxItemIter aIter(rSet);
- for (SfxPoolItem const* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem())
+ for (SfxPoolItem const* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{ // check that the history recorded a hint to reset every item
sal_uInt16 const nWhich(pItem->Which());
sal_uInt16 const nExpected(
@@ -1435,12 +1435,10 @@ void SwRegHistory::MakeSetWhichIds()
if( pSet && pSet->Count() )
{
SfxItemIter aIter( *pSet );
- const SfxPoolItem* pItem = aIter.FirstItem();
- while(pItem)
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
sal_uInt16 nW = pItem->Which();
m_WhichIdSet.insert( nW );
- pItem = aIter.NextItem();
}
}
}
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 683afef3fd17..2169cb9cd285 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -4240,9 +4240,8 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties()
SfxItemSet& rSet = *mpSet;
SfxItemIter aIter(rSet);
- const SfxPoolItem* pItem = aIter.FirstItem();
- while ( pItem )
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
const sal_uInt16 nWID = pItem->Which();
@@ -4258,7 +4257,6 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties()
aPropertyVector.push_back( aPropertyValue );
}
}
- pItem = aIter.NextItem();
}
const sal_Int32 nCount = aPropertyVector.size();
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 8ff8ab08d378..053b43775627 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -2241,8 +2241,7 @@ void SwHTMLParser::InsertParaAttrs( const SfxItemSet& rItemSet )
{
SfxItemIter aIter( rItemSet );
- const SfxPoolItem *pItem = aIter.FirstItem();
- while( pItem )
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
// search for the table entry of the item...
sal_uInt16 nWhich = pItem->Which();
@@ -2258,8 +2257,6 @@ void SwHTMLParser::InsertParaAttrs( const SfxItemSet& rItemSet )
if (!bSuccess)
m_aParaAttrs.pop_back();
}
-
- pItem = aIter.NextItem();
}
}
diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx
index 0c739bfcf590..00f2198b354d 100644
--- a/sw/source/filter/html/htmlctxt.cxx
+++ b/sw/source/filter/html/htmlctxt.cxx
@@ -566,8 +566,7 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet,
SfxItemIter aIter( rItemSet );
- const SfxPoolItem *pItem = aIter.FirstItem();
- while( pItem )
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
HTMLAttr **ppAttr = nullptr;
@@ -727,8 +726,6 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet,
HTMLAttrs &rAttrs = pContext->GetAttrs();
rAttrs.push_back( *ppAttr );
}
-
- pItem = aIter.NextItem();
}
if( !rPropInfo.m_aId.isEmpty() )
diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx
index 8226764e365c..a3823229f6fc 100644
--- a/sw/source/filter/html/htmldrawreader.cxx
+++ b/sw/source/filter/html/htmldrawreader.cxx
@@ -455,11 +455,9 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
{
SfxItemIter aIter( aStyleItemSet );
- const SfxPoolItem *pItem = aIter.FirstItem();
- while( pItem )
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
PutEEPoolItem( aItemSet, *pItem );
- pItem = aIter.NextItem();
}
}
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index e80257079860..0f24525ffc05 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -832,7 +832,7 @@ OUString SwDocStyleSheet::GetDescription(MapUnit eUnit)
SfxItemIter aIter( *pSet );
OUStringBuffer aDesc;
- for (const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem())
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
if(!IsInvalidItem(pItem))
{
@@ -883,7 +883,7 @@ OUString SwDocStyleSheet::GetDescription(MapUnit eUnit)
const drawing::FillStyle eFillStyle(pSet->Get(XATTR_FILLSTYLE).GetValue());
const bool bUseFloatTransparence(pSet->Get(XATTR_FILLFLOATTRANSPARENCE).IsEnabled());
- for ( const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem() )
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
{
if(!IsInvalidItem(pItem))
{
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index dfd7e91e44a6..234413c00c46 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1600,8 +1600,7 @@ void SwWrtShell::AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyl
GetPaMAttr( pCursor, aCoreSet );
bool bReset = false;
SfxItemIter aParaIter( aCoreSet );
- const SfxPoolItem* pParaItem = aParaIter.FirstItem();
- while( pParaItem )
+ for (auto pParaItem = aParaIter.GetCurItem(); pParaItem; pParaItem = aParaIter.NextItem())
{
if(!IsInvalidItem(pParaItem))
{
@@ -1613,7 +1612,6 @@ void SwWrtShell::AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyl
bReset = true;
}
}
- pParaItem = aParaIter.NextItem();
}
StartAction();
if(bReset)