sw/source/core/fields/tblcalc.cxx |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit dc7c73988a6b73298314922d7a4c74ad6c1e518f
Author:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
AuthorDate: Sat Feb 8 18:07:00 2020 +0100
Commit:     Björn Michaelsen <bjoern.michael...@libreoffice.org>
CommitDate: Sun Feb 9 20:06:02 2020 +0100

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

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

Reply via email to