diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-02-08 18:07:00 +0100 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@libreoffice.org> | 2020-02-09 20:06:02 +0100 |
commit | dc7c73988a6b73298314922d7a4c74ad6c1e518f (patch) | |
tree | 9e84b7016f1f7af33d17d1b58679df4be814a507 /sw | |
parent | 57a5c0f04526fc05907334311db5727e665bdde2 (diff) |
Simplify SwTableField::GetNodeOfFormula()
... by using the new SwFormatType::FindFormatForField()
Change-Id: If0492ca04ed836d89bcfcc56572859ba04e084b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88273
Tested-by: Jenkins
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/fields/tblcalc.cxx | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx index a289c3a84430..c93d04a5c4bd 100644 --- a/sw/source/core/fields/tblcalc.cxx +++ b/sw/source/core/fields/tblcalc.cxx @@ -80,14 +80,8 @@ OUString SwTableField::GetFieldName() const /// search TextNode containing this field const SwNode* SwTableField::GetNodeOfFormula() const { - if( !GetTyp()->HasWriterListeners() ) - return nullptr; - - SwIterator<SwFormatField,SwFieldType> aIter( *GetTyp() ); - for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() ) - if( this == pFormatField->GetField() ) - return &pFormatField->GetTextField()->GetTextNode(); - return nullptr; + auto pFormat = GetTyp()->FindFormatForField(this); + return pFormat ? &pFormat->GetTextField()->GetTextNode() : nullptr; } OUString SwTableField::GetCommand() |