diff options
| author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-03-14 22:16:41 +0100 |
|---|---|---|
| committer | Björn Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-03-15 02:20:02 +0100 |
| commit | aeab7de4cd2975b90d07d8b32d51efd953bbff3c (patch) | |
| tree | a96679fbcf9dd88971f9891e2d2c107099e39e2f | |
| parent | 6f82f5163fdd43ea22958dfb28926c88ed97fa7c (diff) | |
docufld.cxx: SwIterator no more ...
Change-Id: Ieb0c9f8aea3fa70260cb74e6b7850fd84108aacb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90498
Tested-by: Jenkins
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
| -rw-r--r-- | sw/source/core/fields/docufld.cxx | 77 |
1 files changed, 35 insertions, 42 deletions
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 4faf7c3bd74a..6b4c4eb39b7c 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -2173,13 +2173,10 @@ void SwRefPageGetFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem* SetGetExpFields aTmpLst; if (MakeSetList(aTmpLst, pLayout)) { - SwIterator<SwFormatField,SwFieldType> aIter( *this ); - for ( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() ) - { - // update only the GetRef fields - if( pFormatField->GetTextField() ) - UpdateField(pFormatField->GetTextField(), aTmpLst, pLayout); - } + std::vector<SwFormatField*> vFields; + GatherFields(vFields); + for(auto pFormatField: vFields) + UpdateField(pFormatField->GetTextField(), aTmpLst, pLayout); } }; @@ -2214,51 +2211,47 @@ bool SwRefPageGetFieldType::MakeSetList(SetGetExpFields& rTmpLst, SwRootFrame const*const pLayout) { IDocumentRedlineAccess const& rIDRA(m_pDoc->getIDocumentRedlineAccess()); - SwIterator<SwFormatField,SwFieldType> aIter(*m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::RefPageSet)); - for ( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() ) + std::vector<SwFormatField*> vFields; + GatherFields(vFields); + for(auto pFormatField: vFields) { // update only the GetRef fields const SwTextField* pTField = pFormatField->GetTextField(); - if( pTField ) + if (!pLayout || !pLayout->IsHideRedlines() || !sw::IsFieldDeletedInModel(rIDRA, *pTField)) { - if (!pLayout || !pLayout->IsHideRedlines() - || !sw::IsFieldDeletedInModel(rIDRA, *pTField)) - { - const SwTextNode& rTextNd = pTField->GetTextNode(); + const SwTextNode& rTextNd = pTField->GetTextNode(); - // Always the first! (in Tab-Headline, header/footer ) - Point aPt; - std::pair<Point, bool> const tmp(aPt, false); - const SwContentFrame *const pFrame = rTextNd.getLayoutFrame( - pLayout, nullptr, &tmp); - - std::unique_ptr<SetGetExpField> pNew; + // Always the first! (in Tab-Headline, header/footer ) + Point aPt; + std::pair<Point, bool> const tmp(aPt, false); + const SwContentFrame *const pFrame = rTextNd.getLayoutFrame( + pLayout, nullptr, &tmp); - if( !pFrame || - pFrame->IsInDocBody() || - // #i31868# - // Check if pFrame is not yet connected to the layout. - !pFrame->FindPageFrame() ) - { - // create index for determination of the TextNode - SwNodeIndex aIdx( rTextNd ); - pNew.reset( new SetGetExpField( aIdx, pTField ) ); - } - else - { - // create index for determination of the TextNode - SwPosition aPos( m_pDoc->GetNodes().GetEndOfPostIts() ); - bool const bResult = GetBodyTextNode( *m_pDoc, aPos, *pFrame ); - OSL_ENSURE(bResult, "where is the Field?"); - pNew.reset( new SetGetExpField( aPos.nNode, pTField, - &aPos.nContent ) ); - } + std::unique_ptr<SetGetExpField> pNew; - rTmpLst.insert( std::move(pNew) ); + if( !pFrame || + pFrame->IsInDocBody() || + // #i31868# + // Check if pFrame is not yet connected to the layout. + !pFrame->FindPageFrame() ) + { + // create index for determination of the TextNode + SwNodeIndex aIdx( rTextNd ); + pNew.reset( new SetGetExpField( aIdx, pTField ) ); } + else + { + // create index for determination of the TextNode + SwPosition aPos( m_pDoc->GetNodes().GetEndOfPostIts() ); + bool const bResult = GetBodyTextNode( *m_pDoc, aPos, *pFrame ); + OSL_ENSURE(bResult, "where is the Field?"); + pNew.reset( new SetGetExpField( aPos.nNode, pTField, + &aPos.nContent ) ); + } + + rTmpLst.insert( std::move(pNew) ); } } - return !rTmpLst.empty(); } |
