sw/source/ui/fldui/fldpage.cxx |   18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

New commits:
commit 85a2ef5cd1b3c06277422b7068eaf1ddc79efdcb
Author:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
AuthorDate: Sun Feb 9 03:10:19 2020 +0100
Commit:     Björn Michaelsen <bjoern.michael...@libreoffice.org>
CommitDate: Mon Feb 10 08:38:16 2020 +0100

    use FindFormatForField some more
    
    Change-Id: I96dc7599d755c035d4079d1bbe6b6c21201034d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88335
    Tested-by: Jenkins
    Reviewed-by: Björn Michaelsen <bjoern.michael...@libreoffice.org>

diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index 94b9caf0ea73..606f149ab331 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -204,20 +204,12 @@ void SwFieldPage::InsertField(SwFieldTypesEnum nTypeId, 
sal_uInt16 nSubType, con
                 aData.nCommandType = rPar1.getToken(0, DB_DELIM, 
nIdx).toInt32();
                 OUString sColumn = rPar1.getToken(0, DB_DELIM, nIdx);
 
-                SwDBFieldType* pOldTyp = 
static_cast<SwDBFieldType*>(pTmpField->GetTyp());
-                SwDBFieldType* pTyp = 
static_cast<SwDBFieldType*>(pSh->InsertFieldType(
-                        SwDBFieldType(pSh->GetDoc(), sColumn, aData)));
-
-                SwIterator<SwFormatField,SwFieldType> aIter( *pOldTyp );
-
-                for( SwFormatField* pFormatField = aIter.First(); 
pFormatField; pFormatField = aIter.Next() )
+                auto pOldType = 
static_cast<SwDBFieldType*>(pTmpField->GetTyp());
+                auto pType = 
static_cast<SwDBFieldType*>(pSh->InsertFieldType(SwDBFieldType(pSh->GetDoc(), 
sColumn, aData)));
+                if(auto pFormatField = 
pOldType->FindFormatForField(m_pCurField))
                 {
-                    if( pFormatField->GetField() == m_pCurField)
-                    {
-                        pFormatField->RegisterToFieldType(*pTyp);
-                        pTmpField->ChgTyp(pTyp);
-                        break;
-                    }
+                    pFormatField->RegisterToFieldType(*pType);
+                    pTmpField->ChgTyp(pType);
                 }
             }
             break;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to