From ac8775e2acd9919e7c0a7cb9dd7139f2874ae86a Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Sat, 21 Mar 2020 01:41:51 +0100 Subject: ddefld.cxx: SwIterator no more ... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (also fix regression from 89d39bc100aabf5dccbe77c0b5c0c85736e85b39 mixing up booleans it seems) Change-Id: If5deb615cec8a8d585dff449c7030f8f97a7afa9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90854 Tested-by: Jenkins Reviewed-by: Björn Michaelsen --- sw/source/core/fields/ddefld.cxx | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'sw/source/core') diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index ebc065153f18..dacd71201b57 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -107,38 +107,35 @@ public: // Search for fields. If no valid found, disconnect. SwMsgPoolItem aUpdateDDE( RES_UPDATEDDETBL ); - bool bCallModify = false; rFieldType.LockModify(); - SwIterator aIter(rFieldType); - for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next()) + std::vector vFields; + rFieldType.GatherFields(vFields, false); + if(vFields.size()) + { + if(pESh) + pESh->StartAllAction(); + else if(pSh) + pSh->StartAction(); + } + + for(auto pFormatField: vFields) { // a DDE table or a DDE field attribute in the text - if( dynamic_cast(pLast) == nullptr || - static_cast(pLast)->GetTextField() ) - { - if( !bCallModify ) - { - if( pESh ) - pESh->StartAllAction(); - else if( pSh ) - pSh->StartAction(); - } - static_cast(pLast)->UpdateTextNode( nullptr, &aUpdateDDE ); - bCallModify = true; - } + if(pFormatField->GetTextField()) + pFormatField->UpdateTextNode( nullptr, &aUpdateDDE ); } rFieldType.UnlockModify(); - if( bCallModify ) + if(vFields.size()) { - if( pESh ) + if(pESh) pESh->EndAllAction(); - else if( pSh ) + else if(pSh) pSh->EndAction(); - if( pSh ) + if(pSh) pSh->GetDoc()->getIDocumentState().SetModified(); } } -- cgit v1.2.3