[Libreoffice-commits] core.git: sw/source
Bjoern Michaelsen (via logerrit)
logerrit at kemper.freedesktop.org
Mon Feb 10 07:38:49 UTC 2020
sw/source/ui/fldui/fldpage.cxx | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
New commits:
commit 85a2ef5cd1b3c06277422b7068eaf1ddc79efdcb
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Sun Feb 9 03:10:19 2020 +0100
Commit: Björn Michaelsen <bjoern.michaelsen at 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.michaelsen at 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;
More information about the Libreoffice-commits
mailing list