sw/source/core/fields/ddefld.cxx |   37 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 20 deletions(-)

New commits:
commit ac8775e2acd9919e7c0a7cb9dd7139f2874ae86a
Author:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
AuthorDate: Sat Mar 21 01:41:51 2020 +0100
Commit:     Björn Michaelsen <bjoern.michael...@libreoffice.org>
CommitDate: Sat Mar 21 23:07:29 2020 +0100

    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.michael...@libreoffice.org>

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();
         }
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to