summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2020-02-09 03:10:19 +0100
committerBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>2020-02-10 08:38:16 +0100
commit85a2ef5cd1b3c06277422b7068eaf1ddc79efdcb (patch)
treeabf1d66927711b7b7dbed3f5819c880e28f1257e /sw
parent4188c7e2132ec3f1c3e879c179e92ff75c86d24f (diff)
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.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/fldui/fldpage.cxx18
1 files changed, 5 insertions, 13 deletions
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;