sw/source/core/doc/doc.cxx | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-)
New commits: commit 913a281eee9ede04aa37af5309e1d4106a49d592 Author: Bjoern Michaelsen <bjoern.michael...@libreoffice.org> AuthorDate: Sat Mar 14 15:27:30 2020 +0100 Commit: Björn Michaelsen <bjoern.michael...@libreoffice.org> CommitDate: Sat Mar 14 18:43:58 2020 +0100 sw_GetPostIts(): SwIterator no more ... Change-Id: I4a8465e2109b3703d0491aaf0578b61e8c00eb6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90490 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michael...@libreoffice.org> diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index ad27eafd802f..26e47a48725f 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -511,39 +511,23 @@ sal_uInt16 PostItField_::GetPageNo( return 0; } -bool sw_GetPostIts( - IDocumentFieldsAccess const * pIDFA, - SetGetExpFields * pSrtLst ) +bool sw_GetPostIts(IDocumentFieldsAccess const* pIDFA, SetGetExpFields* pSrtLst) { - bool bHasPostIts = false; - - SwFieldType* pFieldType = pIDFA->GetSysFieldType( SwFieldIds::Postit ); + SwFieldType* pFieldType = pIDFA->GetSysFieldType(SwFieldIds::Postit); assert(pFieldType); - if( pFieldType->HasWriterListeners() ) - { - // Found modify object; insert all fields into the array - SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType ); - for( SwFormatField* pField = aIter.First(); pField; pField = aIter.Next() ) + std::vector<SwFormatField*> vFields; + pFieldType->GatherFields(vFields); + if(pSrtLst) + for(auto pField: vFields) { - const SwTextField* pTextField; - if( nullptr != ( pTextField = pField->GetTextField() ) && - pTextField->GetTextNode().GetNodes().IsDocNodes() ) - { - bHasPostIts = true; - if (pSrtLst) - { - SwNodeIndex aIdx( pTextField->GetTextNode() ); - std::unique_ptr<PostItField_> pNew(new PostItField_( aIdx, pTextField )); - pSrtLst->insert( std::move(pNew) ); - } - else - break; // we just wanted to check for the existence of postits ... - } - } - } + auto pTextField = pField->GetTextField(); + SwNodeIndex aIdx(pTextField->GetTextNode()); + std::unique_ptr<PostItField_> pNew(new PostItField_(aIdx, pTextField)); + pSrtLst->insert(std::move(pNew)); - return bHasPostIts; + } + return vFields.size()>0; } static void lcl_FormatPostIt( _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits