diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-03-21 01:41:51 +0100 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-03-21 23:07:29 +0100 |
commit | ac8775e2acd9919e7c0a7cb9dd7139f2874ae86a (patch) | |
tree | 399b72bdfab350a6218b8f8ff4fffa7d543eefd3 | |
parent | 3a02e4c424dcf61695c48b31aff4a5ff29acdb72 (diff) |
ddefld.cxx: SwIterator no more ...
(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 <bjoern.michaelsen@libreoffice.org>
-rw-r--r-- | sw/source/core/fields/ddefld.cxx | 37 |
1 files changed, 17 insertions, 20 deletions
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<SwClient,SwFieldType> aIter(rFieldType); - for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next()) + std::vector<SwFormatField*> 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<const SwFormatField *>(pLast) == nullptr || - static_cast<SwFormatField*>(pLast)->GetTextField() ) - { - if( !bCallModify ) - { - if( pESh ) - pESh->StartAllAction(); - else if( pSh ) - pSh->StartAction(); - } - static_cast<SwFormatField*>(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(); } } |